<?php
namespace Home\Controller;
use Think\Controller;
header("Content-type:text/html;charset=utf-8");
class LotteryController extends Controller {
	public function _initialize(){
		$_SESSION['url1'] = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
		$uid = $_SESSION['user_id'];
		if(empty($uid)) {
			$hid = I("hid");
			$this->assign("hid",$hid);
			$this->display("Index/login");
		}
	}
	public function k3_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		if($da['yq_code']){
			$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("k3")->find();//上级给的返点
		}
		$res = M("rebate_k3")->find(); //最基点赔率
		$k3 = array(
			($lv['k3']-0)*0.01+$res['daxiao'],
			($lv['k3']-0)*2.16+$res['he3'],
			($lv['k3']-0)*0.72+$res['he4'],
			($lv['k3']-0)*0.36+$res['he5'],
			($lv['k3']-0)*0.21+$res['he6'],
			($lv['k3']-0)*0.14+$res['he7'],
			($lv['k3']-0)*0.10+$res['he8'],
			($lv['k3']-0)*0.09+$res['he9'],
			($lv['k3']-0)*0.08+$res['he10'],
			($lv['k3']-0)*0.36+$res['t3tx'],
			($lv['k3']-0)*2.16+$res['t3dx'],
			($lv['k3']-0)*0.36+$res['bt3'],
			($lv['k3']-0)*0.09+$res['t3lh'],
			($lv['k3']-0)*0.15+$res['ertfx'],
			($lv['k3']-0)*0.72+$res['ertdx'],
			($lv['k3']-0)*0.07+$res['bt2'],
		);

		$pos=array_search(max($k3),$k3);
		$this->assign("max",$k3[$pos]);
		$pos1=array_search(min($k3),$k3);
		$this->assign("min",$k3[$pos1]);
		$this->assign("k3",$k3);
	}
	//获取 接口数据
	static function get_data($a){
		$zoushitu = M("zoushitu")->where("code='{$a}'")->order("id desc")->limit(10)->select();
		$arr = array();
		foreach($zoushitu as $k=>$v){
			$v['issue'] = trim($v['issue']);
			$v['opencode'] = trim($v['opencode']);
			$v['opentime'] = trim($v['opentime']);
			$v['code'] = trim($v['code']);
			$v['expect'] =$v['issue'];
			$v['ocode'] = explode(",",$v['opencode']);
			$arr[] = $v;
		}
		foreach($arr as $k=>$v){
			$m = 0;
			foreach($v['ocode'] as $kc=>$vc){
				$m+=$vc;
			}
			$arr[$k]['total'] = $m;
			if($m>=3 && $m<=10){
				$arr[$k]['size'] = '1';//小
			}if($m>=11 && $m<=18){
				$arr[$k]['size'] = '2';//大
			}
			if($m%2!=0){
				$arr[$k]['attr'] = '1';//单
			}else{
				$arr[$k]['attr'] = '2';//双
			}
		}
		return $arr;
	}
	public function get_time(){
		$id = I("id");
		$data = M('lottery_class')->where("id=$id")->find();
		foreach($data as $k=>$v){
			$data[$k] = trim($v);
		}
		$time = strtotime(date("Y-m-d")." "."06:00:00");
		if($time>$data['opentimestamp']){
			if($id==1){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."08:30:00");
			}elseif($id==2){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."08:50:00");
			}elseif($id==3){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:28:00");
			}elseif($id==4){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:00:00");
			}elseif($id==5){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:00:00");
			}elseif($id==9){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."08:30:00");
			}elseif($id==10){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:50:00");
			}elseif($id==11){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."08:40:00");
			}elseif($id==12){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:00:00");
			}elseif($id==13){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."08:20:00");
			}elseif($id==15){
				if($data['opentimestamp']>strtotime(date("Y-m-d")." "."01:55:00")&&$data['opentimestamp']<strtotime(date("Y-m-d")." "."10:00:00")){
					$data['opentimestamp']=strtotime(date("Y-m-d")." "."10:00:00");
				}
			}elseif($id==17){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."10:00:00");
			}elseif($id==18){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:00:00");
			}elseif($id==20){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:05:00");
			}elseif($id==21){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:00:00");
			}elseif($id==22){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:10:00");
			}elseif($id==23){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:05:00");
			}elseif($id==24){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."08:35:00");
			}elseif($id==25){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."09:10:00");
			}elseif($id==26){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."00:00:00");
			}elseif($id==27){
				$data['opentimestamp']=strtotime(date("Y-m-d")." "."00:00:00");
			}
		}
		$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
		$ti = $jie-time();

		if($ti < 0){
			$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
			$ti = $jie-time();
		}
		$t = $ti * 1000;
		echo $t;
	}



	//当前 期数
	public function upd_issue(){
		$data['current_issue'] = I('na2');
		$data['coming_issue'] = I('na');
		$id = I("id");
		$dat = M('lottery_class')->where("id=$id")->save($data);
		echo json_encode($data);
	}
	//得到最新结果
	public function get_k3res(){
		$id = I("id");
		$kaij = trim(I("kaij"));
		if($id == '1'){
			$arr = $this->get_data("jsk3");
			if(empty($arr)){
				$arr = M("ren_gong")->where("lotteryclass_id = 1 and issue = '{$kaij}'")->select();
				$arr[0]['expect'] = $arr[0]['issue'];
				foreach($arr as $k=>$v){
					$arr[$k]['ocode'] = explode(",",trim($v['opencode']));
				}
				foreach($arr as $k=>$v){
					$m = 0;
					foreach($v['ocode'] as $kc=>$vc){
						$m+=$vc;
					}
					$arr[$k]['total'] = $m;
					if($m>=3 && $m<=10){
						$arr[$k]['size'] = '1';//小
					}if($m>=11 && $m<=18){
						$arr[$k]['size'] = '2';//大
					}
					if($m%2!=0){
						$arr[$k]['attr'] = '1';//单
					}else{
						$arr[$k]['attr'] = '2';//双
					}
				}
			}
		}
		if($id == '2'){
			$arr = $this->get_data("ahk3");
		}
		if($id == '3'){
			$arr = $this->get_data("gxk3");
		}
		if($id == '4'){
			$arr = $this->get_data("hubk3");
		}
		if($id == '5'){
			$arr = $this->get_data("bjk3");
		}
		if($id == '9'){
			$arr = $this->get_data("hebk3");
		}
		if($id == '10'){
			$arr = $this->get_data("gsk3");
		}
		if($id == '11'){
			$arr = $this->get_data("shk3");
		}
		if($id == '12'){
			$arr = $this->get_data("gzk3");
		}
		if($id == '13'){
			$arr = $this->get_data("jlk3");
		}
		if($arr[0]['expect']==$kaij&&!empty($arr[0]['opencode'])){
			if($arr[0]['size']=='1'){
				$arr[0]['size']='小';
			}
			if($arr[0]['size']=='2'){
				$arr[0]['size']= '大';
			}
			if($arr[0]['attr']=='1'){
				$arr[0]['attr']='单';
			}
			if($arr[0]['attr']=='2'){
				$arr[0]['attr']='双';
			}
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	//江苏快3
	public function jiangsu(){
		$arr = $this->get_data("jsk3");
		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=1")->find();
			$s1 = trim(date("Y-m-d")." ".$data['stime']);//彩票的开始时间
			$s2 = trim(date("Y-m-d")." ".$data['etime']);//彩票的结束时间

			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);//说明在预售中
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];//开奖时间+间隔时间-封单时间
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=1")->order("id desc")->limit(4)->select();
			$tt = $data['jian_time']*60-$data['feng_time'];//间隔的时间*60-封单的时间
			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];//第多少期的开奖号码
				$d['current_issue'] = $arr[0]['expect']+1;//距多少期投注截止还有
				M('lottery_class') ->where("id=1") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;//第多少期的开奖号码
				$d['current_issue'] = $arr[0]['expect']+2;//距多少期投注截止还有
				M('lottery_class') ->where("id=1") ->save($d);
			}
			$da = M('lottery_class') ->where("id=1") ->find();
			$end = date("Ymd")."082";

			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//安徽快3
	public function anhui(){
		$arr = $this->get_data("ahk3");

		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=2")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=2")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=2") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=2") ->save($d);
			}
			$da = M('lottery_class') ->where("id=2") ->find();

			$end = date("Ymd")."080";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end
//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//北京快3
	public function beijing(){
		$arr = $this->get_data("bjk3");
		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=5")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=5")->order("id desc")->limit(4)->select();
			$tt = $data['jian_time']*60-$data['feng_time'];
			if($ti < $tt){
				$nu = $arr[0]['expect']+1;
				$nn = "00000".$nu;
				$cn = substr($nn,-6);
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $cn;
				M('lottery_class') ->where("id=5") ->save($d);

				$nu1 = $arr[0]['expect']+2;
				$nn1 = "00000".$nu1;
				$cn1 = substr($nn1,-6);
			}else{
				$nu = $arr[0]['expect']+1;
				$nn = "00000".$nu;
				$cn = substr($nn,-6);

				$nu1 = $arr[0]['expect']+2;
				$nn1 = "00000".$nu1;
				$cn1 = substr($nn1,-6);
				$d['coming_issue'] = $cn;
				$d['current_issue'] = $cn1;
				M('lottery_class') ->where("id=5") ->save($d);
			}
			$da = M('lottery_class') ->where("id=5") ->find();
			$end = date("Ymd")."089";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end


			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->assign("cn",$cn);
			$this->assign("cn1",$cn1);
			$this->display();
		}
	}
	//广西快3
	public function guangxi(){
		$arr = $this->get_data("gxk3");

		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=3")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){

				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=3")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=3") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=3") ->save($d);
			}
			$da = M('lottery_class') ->where("id=3") ->find();
//      dump($da);die;
			$end = date("Ymd")."078";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$qishu = date('Ymd',time()).'001';

			$this->assign("qishu",$qishu);
			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//湖北快3
	public function hubei()
	{
		$arr = $this->get_data("hubk3");
		$uid = $_SESSION['user_id'];
		if ($uid) {
			self::k3_comm();
			$data = M('lottery_class')->where("id=4")->find();
			$s1 = date("Y-m-d") . " " . $data['stime'];
			$s2 = date("Y-m-d") . " " . $data['etime'];
			if (strtotime($s1) > time() || strtotime($s2) < time()) {
				$this->assign("state", 1);
			}
			$jie = $data['opentimestamp'] + $data['jian_time'] * 60 - $data['feng_time'];
			$ti = $jie - time();
			if ($ti < 0) {
				$jie = $data['opentimestamp'] + $data['jian_time'] * 60 * 2 - $data['feng_time'];
				$ti = $jie - time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=4")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time'] * 60 - $data['feng_time'];

			if ($ti < $tt) {
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect'] + 1;
				M('lottery_class')->where("id=4")->save($d);
			} else {
				$d['coming_issue'] = $arr[0]['expect'] + 1;
				$d['current_issue'] = $arr[0]['expect'] + 2;
				M('lottery_class')->where("id=4")->save($d);
			}
			$da = M('lottery_class')->where("id=4")->find();
			$end = date("Ymd") . "078";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym") . $days;
			$ming = date("Y-m-d", (strtotime(date("Y-m-") . $days) + 3600 * 24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on la.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on ls.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on lp.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on lk.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on l1.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on lf.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on zk.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on zp.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on zs.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join " . C("DB_PREFIX") . "accountsinfo a on zx.uid=a.userid")
				->join(" join " . C("DB_PREFIX") . "lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1, $r2, $r3, $r4, $r5, $r6, $r7, $r8, $r9, $r10);

			$tu1 = array();
			foreach ($r as $kp => $vp) {
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",", $tu1);
			if ($tuss) {
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach ($r as $ka1 => $va) {
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if ($va['uid'] == $value1['uid']) {
						$total += $value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if ($va['uid'] == $value21['uid']) {
						$total += $value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if ($va['uid'] == $value31['uid']) {
						$total += $value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if ($va['uid'] == $value41['uid']) {
						$total += $value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if ($va['uid'] == $value51['uid']) {
						$total += $value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if ($va['uid'] == $value61['uid']) {
						$total += $value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if ($va['uid'] == $value71['uid']) {
						$total += $value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if ($va['uid'] == $value81['uid']) {
						$total += $value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if ($va['uid'] == $value91['uid']) {
						$total += $value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if ($va['uid'] == $value101['uid']) {
						$total += $value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if ($va['score'] < '10') {
					$touxie = 'VIP1';
					$zhiw = "农民";
				} elseif ('10' <= $va['score'] && $va['score'] < '200') {
					$touxie = 'VIP2';
					$zhiw = "地主";
				} elseif ('200' <= $va['score'] && $va['score'] < '1000') {
					$touxie = 'VIP3';
					$zhiw = "知县";
				} elseif ('1000' <= $va['score'] && $va['score'] < '10000') {
					$touxie = 'VIP4';
					$zhiw = "通判";
				} elseif ('10000' <= $va['score'] && $va['score'] < '50000') {
					$touxie = 'VIP5';
					$zhiw = "知府";
				} elseif ('50000' <= $va['score'] && $va['score'] < '250000') {
					$touxie = 'VIP6';
					$zhiw = "总督";
				} elseif ('250000' <= $va['score'] && $va['score'] < '1000000') {
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				} elseif ('1000000' <= $va['score'] && $va['score'] < '5000000') {
					$touxie = 'VIP8';
					$zhiw = "丞相";
				} elseif ('5000000' <= $va['score']) {
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if ($va['sex'] == '1') {
					$sex = "男";
				}
				if ($va['sex'] == '2') {
					$sex = "女";
				}
				if ($va['sex'] == '3') {
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1", $data1);

			$this->assign("r", $r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach ($data as $kk => $vv) {
				$tu[] = $vv['userid'];
			}
			$tus = implode(",", $tu);
			$start = strtotime(date("Y-m-d", strtotime("-1 day")) . " 00:00:00");
			$end1 = strtotime(date("Y-m-d", strtotime("-1 day")) . " 23:59:59");
			if ($tus) {
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach ($data as $ka => $va) {
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if ($va['userid'] == $value['uid']) {
						$zuo += $value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if ($va['userid'] == $value2['uid']) {
						$zuo += $value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if ($va['userid'] == $value3['uid']) {
						$zuo += $value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if ($va['userid'] == $value4['uid']) {
						$zuo += $value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if ($va['userid'] == $value5['uid']) {
						$zuo += $value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if ($va['userid'] == $value6['uid']) {
						$zuo += $value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if ($va['userid'] == $value7['uid']) {
						$zuo += $value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if ($va['userid'] == $value8['uid']) {
						$zuo += $value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if ($va['userid'] == $value9['uid']) {
						$zuo += $value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if ($va['userid'] == $value10['uid']) {
						$zuo += $value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if ($va['userid'] == $value1['uid']) {
						$total += $value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if ($va['userid'] == $value21['uid']) {
						$total += $value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if ($va['userid'] == $value31['uid']) {
						$total += $value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if ($va['userid'] == $value41['uid']) {
						$total += $value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if ($va['userid'] == $value51['uid']) {
						$total += $value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if ($va['userid'] == $value61['uid']) {
						$total += $value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if ($va['userid'] == $value71['uid']) {
						$total += $value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if ($va['userid'] == $value81['uid']) {
						$total += $value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if ($va['userid'] == $value91['uid']) {
						$total += $value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if ($va['userid'] == $value101['uid']) {
						$total += $value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if ($va['score'] < '10') {
					$touxie = 'VIP1';
					$zhiw = "农民";
				} elseif ('10' <= $va['score'] && $va['score'] < '200') {
					$touxie = 'VIP2';
					$zhiw = "地主";
				} elseif ('200' <= $va['score'] && $va['score'] < '1000') {
					$touxie = 'VIP3';
					$zhiw = "知县";
				} elseif ('1000' <= $va['score'] && $va['score'] < '10000') {
					$touxie = 'VIP4';
					$zhiw = "通判";
				} elseif ('10000' <= $va['score'] && $va['score'] < '50000') {
					$touxie = 'VIP5';
					$zhiw = "知府";
				} elseif ('50000' <= $va['score'] && $va['score'] < '250000') {
					$touxie = 'VIP6';
					$zhiw = "总督";
				} elseif ('250000' <= $va['score'] && $va['score'] < '1000000') {
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				} elseif ('1000000' <= $va['score'] && $va['score'] < '5000000') {
					$touxie = 'VIP8';
					$zhiw = "丞相";
				} elseif ('5000000' <= $va['score']) {
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if ($va['sex'] == '1') {
					$sex = "男";
				}
				if ($va['sex'] == '2') {
					$sex = "女";
				}
				if ($va['sex'] == '3') {
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data, 0, 10);
			$this->assign("da", $da1);
//昨日奖金榜 end

			$this->assign("end", $end);//最后一期
			$this->assign("str", $str);//月底
			$this->assign("ming", $ming);//明天
			$this->assign("ti", $ti);
			$this->assign("arr", $arr);
			$this->assign("res", $res);
			$this->assign("dat", $da);
			$this->display();
		}
	}
	//河北快3
	public function hebei(){
		$arr = $this->get_data("hebk3");

		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=9")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=9")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=9") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=9") ->save($d);
			}
			$da = M('lottery_class') ->where("id=9") ->find();
			$end = date("Ymd")."081";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//甘肃快3
	public function gansu(){
		$arr = $this->get_data("gsk3");
//		dump($arr);die;
		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=10")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];//开始时间
			$s2 = date("Y-m-d")." ".$data['etime'];//结束时间
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];  //开奖时间+间隔时间-封单时间
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}

			$res = M("lottery_add")->where("uid = $uid and lotteryclass=10")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];//间隔时间-封单时间

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];//上期期号
				$d['current_issue'] = $arr[0]['expect']+1;//未开奖的期号
				M('lottery_class') ->where("id=10") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=10") ->save($d);
			}
			$da = M('lottery_class') ->where("id=10") ->find();
			$end = date("Ymd")."072";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}}
	//上海快3
	public function shanghai(){
		$arr = $this->get_data("shk3");
		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=11")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=11")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=11") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=11") ->save($d);
			}
			$da = M('lottery_class') ->where("id=11") ->find();
			$end = date("Ymd")."082";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));
			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}}
	//贵州快3
	public function guizhou(){
		$arr = $this->get_data("gzk3");
		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=12")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=12")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=12") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=12") ->save($d);
			}
			$da = M('lottery_class') ->where("id=12") ->find();
			$end = date("Ymd")."078";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}}
	//吉林快3
	public function jilin(){
		$arr = $this->get_data("jlk3");
		$uid = $_SESSION['user_id'];
		if($uid){
			self::k3_comm();
			$data = M('lottery_class')->where("id=13")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_add")->where("uid = $uid and lotteryclass=13")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=13") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=13") ->save($d);
			}
			$da = M('lottery_class') ->where("id=13") ->find();
			$end = date("Ymd")."079";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}}

	//添加 投注
	public function adds(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'lotteryclass' => Admin_post('lottery_class_id'),
			'issue' => trim(Admin_post('issue')),
			'pour' => Admin_post('zhus'),
			'money' => Admin_post('mons'),
			'numbers' => "TZ".date(md).time(),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("money,yq_code")->find();
		if($mm['money'] < $search['money']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['money']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',$search['money']);
			$ddd10 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd10['sheng_money']<=0){
				$dd10['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd10);
			}
		}
		$ids = M('lottery_add')->add($search);
		$dat = array();
		$arr = I('ty_name');
		$vs = I('vls');
		$pr = I('pours');
		$pm = I('per_money');
		$am = I('add_money');
		foreach($arr as $k=>$v){
			$dat[$k]['lottery_add_id'] = $ids;
			$dat[$k]['type'] = $v;
			$dat[$k]['cal'] = $vs[$k];//选择的值
			$dat[$k]['pours'] = $pr[$k];//买了几注
			$dat[$k]['moneys'] = $am[$k];//每注 多少钱
			$dat[$k]['con_money'] = $pm[$k] * $am[$k];//可中金额
		}
		$res = M("lottery_add_detail")->addAll($dat);
		if($res){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,k3")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;){
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						if ($tr['yq_code']) {
							$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("uid,k3")->find();//上级返点
						}
						$momm = (($c1['k3'] - $cc['k3']) / 100) * $search['money'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();

						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if($c1['uid']!='0'){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['money'];
				$cp['ky_money'] = $mm['money'] - $search['money'];
				$cp['ctime'] = time();
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function get_sscres(){
		$id = I("id");
		$kaij = I("kaij");
		if($id == '15'){
			$arr = $this->get_data2("cqssc");
		}
		if($id == '17'){
			$arr = $this->get_data2("xjssc");
		}
		if($id == '18'){
			$arr = $this->get_data2("tjssc");
		}
		if($id == '19'){
			$arr = $this->get_data2("ffc2");
		}
//		var_dump($arr);die;
		if($arr[0]['expect']==$kaij&&!empty($arr[0]['opencode'])){
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	//获取 时时彩 接口数据
	static function get_data2($a){

		$where = $a;
		$data = M("zoushitu")->where("code = '{$where}'")->order("id desc")->field("id,issue expect,opencode,opentime")->limit(18)->select();
//		$data = M("zoushitu")->where("code = '{$where}'")->group('issue')->order("id desc")->field("id,issue expect,opencode,opentime")->limit(18)->select();
		$arr = $data;
		$arr1 = array();
		foreach($arr as $k=>$v){
			$v['opencode'] = trim($v['opencode']);
			$arr[$k]['opentimestamp'] = strtotime($v['opentime']);
			$arr[$k]['otime'] = date("H:i:s",$arr[$k]['opentimestamp']);
			$arr[$k]['ocode'] = explode(",",$v['opencode']);
			$arr1[] = array(
				'expect' => trim($arr[$k]['expect']),
				'opencode' => trim($arr[$k]['opencode']),
				'opentime' => trim($arr[$k]['opentime']),
				'opentimestamp' => trim($arr[$k]['opentimestamp']),
				'otime' => trim($arr[$k]['otime']),
				'ocode' => $arr[$k]['ocode'],
			);
		}
		$arr = $arr1;
		return $arr;
	}
	public function ssc_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		if($da['yq_code']){
			$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("ssc")->find();
		}

		$res = M("rebate_ssc")->find();//后台设置赔率

		$ssc = array(
			($lv['ssc']-0)*0.08+$res['dx2xing'],
			($lv['ssc']-0)*0.16+$res['dx3xing'],
			($lv['ssc']-0)*0.2+$res['yxingfs'],
			($lv['ssc']-0)*2+$res['exingzxfs'],
			($lv['ssc']-0)*2+$res['exingzxds'],
			($lv['ssc']-0)*2+$res['exingzxhz'],
			($lv['ssc']-0)*2+$res['exingkadu'],
			($lv['ssc']-0)*1+$res['exingzufs'],
			($lv['ssc']-0)*1+$res['exingzuds'],
			($lv['ssc']-0)*1+$res['exingzuhz'],
			($lv['ssc']-0)*1+$res['exingzubd'],
			($lv['ssc']-0)*20+$res['sxingfs'],
			($lv['ssc']-0)*20+$res['sxingds'],
			($lv['ssc']-0)*20+$res['sxingzhz'],
			($lv['ssc']-0)*20+$res['sxingkudu'],
			($lv['ssc']-0)*3.33+$res['sxingzuhe'],
			($lv['ssc']-0)*6.66+$res['sxingzu3'],
			($lv['ssc']-0)*3.33+$res['sxingzu6'],
			($lv['ssc']-0)*3.33+$res['sxinghunhe'],
			($lv['ssc']-0)*3.33+$res['sxingzubd'],
			($lv['ssc']-0)*6.66+$res['sxingzu3ds'],
			($lv['ssc']-0)*3.33+$res['sxingzu6ds'],
			($lv['ssc']-0)*0.07+$res['sxingyima'],
			($lv['ssc']-0)*0.37+$res['sxingerma'],
			($lv['ssc']-0)*2000+$res['fxingfs'],
			($lv['ssc']-0)*2000+$res['fxingds'],
			($lv['ssc']-0)*3.33+$res['fxingzu24'],
			($lv['ssc']-0)*16.66+$res['fxingzu12'],
			($lv['ssc']-0)*33.33+$res['fxingzu6'],
			($lv['ssc']-0)*50+$res['fxingzu4'],
			($lv['ssc']-0)*0.06+$res['fxingyima'],
			($lv['ssc']-0)*0.2+$res['fxingerma'],
			($lv['ssc']-0)*2000+$res['wxingfs'],
			($lv['ssc']-0)*2000+$res['wxingds'],
			($lv['ssc']-0)*16.66+$res['wxingzu120'],
			($lv['ssc']-0)*33.33+$res['wxingzu60'],
			($lv['ssc']-0)*66.66+$res['wxingzu30'],
			($lv['ssc']-0)*100+$res['wxingzu20'],
			($lv['ssc']-0)*200+$res['wxingzu10'],
			($lv['ssc']-0)*400+$res['wxingzu5'],
			($lv['ssc']-0)*0.05+$res['wxingyima'],
			($lv['ssc']-0)*0.14+$res['wxingerma'],
			($lv['ssc']-0)*0.46+$res['wxingsanma'],
			($lv['ssc']-0)*0.05+$res['wxingyifan'],
			($lv['ssc']-0)*0.25+$res['wxinghaos'],
			($lv['ssc']-0)*2.33+$res['wxingbaox'],
			($lv['ssc']-0)*43.48+$res['wxingsiji']
		);

//		dump($ssc);die;
		$pos=array_search(max($ssc),$ssc);
		$this->assign("max",$ssc[$pos]);
		$pos1=array_search(min($ssc),$ssc);
		$this->assign("min",$ssc[$pos1]);
		$this->assign("ssc",$ssc);
	}
	//去重



	//重庆时时彩
	public function cqssc(){
		$arr = $this->get_data2("cqssc");

		$uid = $_SESSION['user_id'];
		if($uid){
			self::ssc_comm();
			$tim = strtotime(date("Y-m-d")." 10:00");//白天开始时间

			$tim1 = strtotime(date("Y-m-d")." 22:00");//白天结束时间

			if(time() >= $tim && time()<=$tim1){
				$we['stime'] = '10:00';
				$we['etime'] = '22:00';
				$we['jian_time'] = '10';
				M('lottery_class')->where("id=15")->save($we);
			}elseif(time() >= $tim1 || time() <= $tim ){
				$we['stime'] = '22:00';
				$we['etime'] = '01:55';
				$we['jian_time'] = '5';
				M('lottery_class')->where("id=15")->save($we);
			}
			$data = M('lottery_class')->where("id=15")->find();
			$s1 = date("Y-m-d")." ".$data['stime']; //当天开始的时间
			$ss = date("Y-m-d")." ".$data['etime'];//结束的时间

			if($ss < time()){  //如果当前时间大于结束时间
				$s2 = date("Y-m-d",strtotime("+1 day"))." ".$data['etime'];
			}else{
				$s2 = date("Y-m-d")." ".$data['etime'];
			}

			if(strtotime($s1) > time()){  //如果当前时间大于结束时间
				$s1 = date("Y-m-d",strtotime("-1day"))." ".$data['stime'];
			}else{
				$s1 = date("Y-m-d")." ".$data['stime'];
			}


			if(strtotime($s2) < time()||strtotime($s1)> time() || $data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_ssc")->where("uid = $uid and lotteryclass=15")->order("id desc")->limit(4)->select();
			$tt = $data['jian_time']*60-$data['feng_time'];
			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=15") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=15") ->save($d);
			}
			$da = M('lottery_class') ->where("id=15") ->find();
			$end = substr($da['issue'],0,8)."120";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));




			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天

			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//天津时时彩
	public function tjssc(){
		$uid = $_SESSION['user_id'];
		if($uid){
			self::ssc_comm();
			$arr = $this->get_data2("tjssc");
			$data = M('lottery_class')->where("id=18")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_ssc")->where("uid = $uid and lotteryclass=18")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=18") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=18") ->save($d);
			}
			$da = M('lottery_class') ->where("id=18") ->find();
			$end = date("Ymd")."084";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//新疆时时彩
	public function xjssc(){
		$arr = $this->get_data2("xjssc");
		$uid = $_SESSION['user_id'];

		self::ssc_comm();
		$data = M('lottery_class')->where("id=17")->find();
		$s1 = date("Y-m-d")." ".trim($data['stime']);

		if(strtotime($data['etime']) < strtotime($data['stime'])){
			$s2 = date("Y-m-d",strtotime("+1 day"))." ".$data['etime'];
		}else{
			$s2 = date("Y-m-d")." ".trim($data['etime']);
		}
		if(strtotime($s2) < time()||strtotime($s1) > time()||$data['type']==1){
			$this->assign("state",1);
		}

		$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
		$ti = $jie-time();

		if($ti < 0){
			$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
			$ti = $jie-time();
		}

		$res = M("lottery_ssc")->where("uid = $uid and lotteryclass=17")->order("id desc")->limit(4)->select();
		$tt = $data['jian_time']*60-$data['feng_time'];
		if($ti < $tt){
			$d['coming_issue'] = $arr[0]['expect'];
			$d['current_issue'] = $arr[0]['expect']+1;
			M('lottery_class') ->where("id=17") ->save($d);
		}else{
			$d['coming_issue'] = $arr[0]['expect']+1;
			$d['current_issue'] = $arr[0]['expect']+2;
			M('lottery_class') ->where("id=17") ->save($d);
		}


		$da = M('lottery_class') ->where("id=17") ->find();
		$end = substr($da['issue'],0,8)."96";
		$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
		$str = date("Ym").$days;
		$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

		//中奖信息 begin
		$r1 = M("lottery_add la")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
			->where("la.zong_money>0")
			->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
			->select();
		$r2 = M("lottery_ssc ls")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
			->where("ls.zong_money>0")
			->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
			->select();
		$r3 = M("lottery_pk10 lp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
			->where("lp.zong_money>0")
			->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
			->select();
		$r4 = M("lottery_kl8 lk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
			->where("lk.zong_money>0")
			->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
			->select();
		$r5 = M("lottery_11x5 l1")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
			->where("l1.zong_money>0")
			->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
			->select();
		$r6 = M("lottery_fc3d lf")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
			->where("lf.zong_money>0")
			->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
			->select();
		$r7 = M("zhui_kl8 zk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
			->where("zk.zo_money>0")
			->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
			->select();
		$r8 = M("zhui_pk10 zp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
			->where("zp.zo_money>0")
			->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
			->select();
		$r9 = M("zhui_ssc zs")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
			->where("zs.zo_money>0")
			->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
			->select();
		$r10 = M("zhui_x5 zx")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
			->where("zx.zo_money>0")
			->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
			->select();
		$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

		$tu1 = array();
		foreach($r as $kp=>$vp){
			$tu1[] = $vp['uid'];
		}
		$tuss = implode(",",$tu1);
		if($tuss){
			$where1 = "uid in($tuss)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($r as $ka1=>$va){
			$total = 0;//总
			foreach ($sum11 as $key1 => $value1) {
				if($va['uid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['uid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['uid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['uid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['uid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['uid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['uid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['uid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['uid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['uid']==$value101['uid']){
					$total+=$value101['zo_money'];
				}
			}
			$r[$ka1]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$r[$ka1]['touxie'] = $touxie;
			$r[$ka1]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$r[$ka1]['sex'] = $sex;
		}
		$age = array();
		foreach ($r as $users) {
			$age[] = $users['ctime'];
		}
		array_multisort($age, SORT_DESC, $r);

		$data1 = M("notice")->select();
		$this->assign("data1",$data1);

		$this->assign("r",$r);
		//中奖信息 end


//		昨日奖金榜 begin
		$data = M('Accountsinfo')
			->field("userid,nickname,avatar,accounts,sex,score")
			->select();
		$tu = array();
		foreach($data as $kk=>$vv){
			$tu[] = $vv['userid'];
		}
		$tus = implode(",",$tu);
		$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
		$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
		if($tus){
			$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
			$sum1 = M("lottery_add")->where($where)->select();
			$sum2 = M("lottery_ssc")->where($where)->select();
			$sum3 = M("lottery_pk10")->where($where)->select();
			$sum4 = M("lottery_kl8")->where($where)->select();
			$sum5 = M("lottery_11x5")->where($where)->select();
			$sum6 = M("lottery_fc3d")->where($where)->select();
			$sum7 = M("zhui_kl8")->where($where)->select();
			$sum8 = M("zhui_pk10")->where($where)->select();
			$sum9 = M("zhui_ssc")->where($where)->select();
			$sum10 = M("zhui_x5")->where($where)->select();
			$where1 = "uid in($tus)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($data as $ka=>$va){
			$total = 0;//总
			$zuo = 0;//昨日
			foreach ($sum1 as $key => $value) {
				if($va['userid']==$value['uid']){
					$zuo+=$value['zong_money'];
				}
			}
			foreach ($sum2 as $key2 => $value2) {
				if($va['userid']==$value2['uid']){
					$zuo+=$value2['zong_money'];
				}
			}
			foreach ($sum3 as $key3 => $value3) {
				if($va['userid']==$value3['uid']){
					$zuo+=$value3['zong_money'];
				}
			}
			foreach ($sum4 as $key4 => $value4) {
				if($va['userid']==$value4['uid']){
					$zuo+=$value4['zong_money'];
				}
			}
			foreach ($sum5 as $key5 => $value5) {
				if($va['userid']==$value5['uid']){
					$zuo+=$value5['zong_money'];
				}
			}
			foreach ($sum6 as $key6 => $value6) {
				if($va['userid']==$value6['uid']){
					$zuo+=$value6['zong_money'];
				}
			}
			foreach ($sum7 as $key7 => $value7) {
				if($va['userid']==$value7['uid']){
					$zuo+=$value7['zo_money'];
				}
			}
			foreach ($sum8 as $key8 => $value8) {
				if($va['userid']==$value8['uid']){
					$zuo+=$value8['zo_money'];
				}
			}
			foreach ($sum9 as $key9 => $value9) {
				if($va['userid']==$value9['uid']){
					$zuo+=$value9['zo_money'];
				}
			}
			foreach ($sum10 as $key10 => $value10) {
				if($va['userid']==$value10['uid']){
					$zuo+=$value10['zong_money'];
				}
			}
			foreach ($sum11 as $key1 => $value1) {
				if($va['userid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['userid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['userid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['userid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['userid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['userid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['userid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['userid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['userid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['userid']==$value101['uid']){
					$total+=$value101['zong_money'];
				}
			}
			$data[$ka]['zuo_money'] = $zuo;
			$data[$ka]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$data[$ka]['touxie'] = $touxie;
			$data[$ka]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$data[$ka]['sex'] = $sex;
		}
		$ages = array();
		foreach ($data as $user) {
			$ages[] = $user['zuo_money'];
		}
		array_multisort($ages, SORT_DESC, $data);
		$da1 = array_slice($data,0,10);
		$this->assign("da",$da1);
//昨日奖金榜 end

		$this->assign("end",$end);//最后一期
		$this->assign("str",$str);//月底
		$this->assign("ming",$ming);//明天

		$this->assign("ti",$ti);
		$this->assign("arr",$arr);
		$this->assign("res",$res);
		$this->assign("dat",$da);
		$this->display();
	}
	//埃及
	public function aiji(){
		$uid = $_SESSION['user_id'];
		$arr = $this->get_data2("ffc2");
		$data = M('lottery_class')->where("id=19")->field("opentimestamp,jian_time,feng_time")->find();
		$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
		$ti = $jie-time();
		if($ti < 0){
			$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
			$ti = $jie-time();
		}
		$tt = $data['jian_time']*60-$data['feng_time'];
		if($ti < $tt){
			$d['coming_issue'] = $arr[0]['expect'];
			$d['current_issue'] = $arr[0]['expect']+1;
			M('lottery_class') ->where("id=19") ->save($d);
		}else{
			$d['coming_issue'] = $arr[0]['expect']+1;
			$d['current_issue'] = $arr[0]['expect']+2;
			M('lottery_class') ->where("id=19") ->save($d);
		}
		$da = M('lottery_class') ->where("id=19") ->find();
		self::ssc_comm();
		//中奖信息 begin
		$r1 = M("lottery_add la")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
			->where("la.zong_money>0")
			->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
			->select();
		$r2 = M("lottery_ssc ls")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
			->where("ls.zong_money>0")
			->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
			->select();
		$r3 = M("lottery_pk10 lp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
			->where("lp.zong_money>0")
			->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
			->select();
		$r4 = M("lottery_kl8 lk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
			->where("lk.zong_money>0")
			->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
			->select();
		$r5 = M("lottery_11x5 l1")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
			->where("l1.zong_money>0")
			->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
			->select();
		$r6 = M("lottery_fc3d lf")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
			->where("lf.zong_money>0")
			->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
			->select();
		$r7 = M("zhui_kl8 zk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
			->where("zk.zo_money>0")
			->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
			->select();
		$r8 = M("zhui_pk10 zp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
			->where("zp.zo_money>0")
			->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
			->select();
		$r9 = M("zhui_ssc zs")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
			->where("zs.zo_money>0")
			->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
			->select();
		$r10 = M("zhui_x5 zx")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
			->where("zx.zo_money>0")
			->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
			->select();
		$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

		$tu1 = array();
		foreach($r as $kp=>$vp){
			$tu1[] = $vp['uid'];
		}
		$tuss = implode(",",$tu1);
		if($tuss){
			$where1 = "uid in($tuss)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($r as $ka1=>$va){
			$total = 0;//总
			foreach ($sum11 as $key1 => $value1) {
				if($va['uid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['uid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['uid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['uid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['uid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['uid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['uid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['uid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['uid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['uid']==$value101['uid']){
					$total+=$value101['zo_money'];
				}
			}
			$r[$ka1]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$r[$ka1]['touxie'] = $touxie;
			$r[$ka1]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$r[$ka1]['sex'] = $sex;
		}
		$age = array();
		foreach ($r as $users) {
			$age[] = $users['ctime'];
		}
		array_multisort($age, SORT_DESC, $r);

		$data1 = M("notice")->select();
		$this->assign("data1",$data1);

		$this->assign("r",$r);
		//中奖信息 end


//		昨日奖金榜 begin
		$data = M('Accountsinfo')
			->field("userid,nickname,avatar,accounts,sex,score")
			->select();
		$tu = array();
		foreach($data as $kk=>$vv){
			$tu[] = $vv['userid'];
		}
		$tus = implode(",",$tu);
		$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
		$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
		if($tus){
			$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
			$sum1 = M("lottery_add")->where($where)->select();
			$sum2 = M("lottery_ssc")->where($where)->select();
			$sum3 = M("lottery_pk10")->where($where)->select();
			$sum4 = M("lottery_kl8")->where($where)->select();
			$sum5 = M("lottery_11x5")->where($where)->select();
			$sum6 = M("lottery_fc3d")->where($where)->select();
			$sum7 = M("zhui_kl8")->where($where)->select();
			$sum8 = M("zhui_pk10")->where($where)->select();
			$sum9 = M("zhui_ssc")->where($where)->select();
			$sum10 = M("zhui_x5")->where($where)->select();
			$where1 = "uid in($tus)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($data as $ka=>$va){
			$total = 0;//总
			$zuo = 0;//昨日
			foreach ($sum1 as $key => $value) {
				if($va['userid']==$value['uid']){
					$zuo+=$value['zong_money'];
				}
			}
			foreach ($sum2 as $key2 => $value2) {
				if($va['userid']==$value2['uid']){
					$zuo+=$value2['zong_money'];
				}
			}
			foreach ($sum3 as $key3 => $value3) {
				if($va['userid']==$value3['uid']){
					$zuo+=$value3['zong_money'];
				}
			}
			foreach ($sum4 as $key4 => $value4) {
				if($va['userid']==$value4['uid']){
					$zuo+=$value4['zong_money'];
				}
			}
			foreach ($sum5 as $key5 => $value5) {
				if($va['userid']==$value5['uid']){
					$zuo+=$value5['zong_money'];
				}
			}
			foreach ($sum6 as $key6 => $value6) {
				if($va['userid']==$value6['uid']){
					$zuo+=$value6['zong_money'];
				}
			}
			foreach ($sum7 as $key7 => $value7) {
				if($va['userid']==$value7['uid']){
					$zuo+=$value7['zo_money'];
				}
			}
			foreach ($sum8 as $key8 => $value8) {
				if($va['userid']==$value8['uid']){
					$zuo+=$value8['zo_money'];
				}
			}
			foreach ($sum9 as $key9 => $value9) {
				if($va['userid']==$value9['uid']){
					$zuo+=$value9['zo_money'];
				}
			}
			foreach ($sum10 as $key10 => $value10) {
				if($va['userid']==$value10['uid']){
					$zuo+=$value10['zong_money'];
				}
			}
			foreach ($sum11 as $key1 => $value1) {
				if($va['userid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['userid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['userid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['userid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['userid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['userid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['userid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['userid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['userid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['userid']==$value101['uid']){
					$total+=$value101['zong_money'];
				}
			}
			$data[$ka]['zuo_money'] = $zuo;
			$data[$ka]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$data[$ka]['touxie'] = $touxie;
			$data[$ka]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$data[$ka]['sex'] = $sex;
		}
		$ages = array();
		foreach ($data as $user) {
			$ages[] = $user['zuo_money'];
		}
		array_multisort($ages, SORT_DESC, $data);
		$da1 = array_slice($data,0,10);
		$this->assign("da",$da1);
//昨日奖金榜 end
		$res = M("lottery_ssc")->where("uid = $uid and lotteryclass=19")->order("id desc")->limit(4)->select();
		$this->assign("ti",$ti);
		$this->assign("arr",$arr);
		$this->assign("res",$res);
		$this->assign("dat",$da);
		$this->display();
	}
	//添加时时彩
	public function ssc_add(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'lotteryclass' => Admin_post('lotteryclass'),
			'issue' => trim(Admin_post('issue')),
			'pour' => Admin_post('pour'),
			'money' => Admin_post('money'),
			'numbers' => "TZ".date(md).time(),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['money']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['money']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',$search['money']);
			$ddd9 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd9['sheng_money']<=0){
				$dd9['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd9);
			}
		}
		$ids = M('lottery_ssc')->add($search);
		$dat = array();
		$arr = I('type');
		$arr2 = I('m_type');
		$vs = I('cal');

		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');

		$zh = I('zhong_money');
		foreach($arr as $k=>$v){
			$dat[$k]['lottery_ssc_id'] = $ids;
			$dat[$k]['type'] = $v;
			$dat[$k]['m_type'] = $arr2[$k];
			$dat[$k]['cal'] = $vs[$k];//选择的值
			$dat[$k]['pours'] = $pr[$k];//买了几注
			$dat[$k]['bei'] = $be[$k];//多少倍
			$dat[$k]['unit'] = $un[$k];//单位
			$dat[$k]['zo_money'] = $zh[$k] * $be[$k];//可中金额
		}

		$re = M("lottery_ssc_detail")->addAll($dat);

		if($re){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,ssc")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("ssc")->find();//上级返点
						$momm = (($c1['ssc'] - $cc['ssc']) / 100) * $search['money'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['money'];
				$cp['ky_money'] = $mm['money'] - $search['money'];
				$cp['ctime'] = time();
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';

				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function adds_zhui_ssc(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'numbers' => "TZ".date(md).time(),
			'start_num' => Admin_post('start_number'),
			'lotteryclass' => Admin_post('lotteryclass'),
			'qishus' => Admin_post('qis'),
			'zhus' => Admin_post('zhus'),
			'moneys' => Admin_post('moneys'),
			'is_ting' => Admin_post('is_ting'),
			'z_type' => Admin_post('ch'),
			'lv1' => Admin_post('lv1'),
			'lv2_qi' => Admin_post('lv2_qi'),
			'lv2' => Admin_post('lv2'),
			'lv3' => Admin_post('lv3'),
			'z_type2' => Admin_post('z_type2'),
			'ctime' => time()
		);

		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();

		if($mm['money'] < $search['moneys']){
			echo 3;die;
		}else{

			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['moneys']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',($mm['money']-$search['money']));
			$ddd8 = M('Accountsinfo')->where("userid = '{$search["uid"]}'")->find();

			if($ddd8['sheng_money']<=0){
				$dd8['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd8);
			}
		}
		$ids = M('zhui_ssc')->add($search);
		$dat = array();
		$arr = I('ren_type');
		$arr2 = I('ren_type2');
		$vs = I('cal');
		$issue = I('issue');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong');
		$touzhu = I('touzhu');
		$i=0;
		foreach($issue as $k=>$v){
			foreach($arr as $kk=>$vv){
				$dat[$i]['zhui_ssc_id'] = $ids;
				$dat[$i]['issue'] = $v;
				$dat[$i]['bei'] = $be[$k];//多少倍
				$dat[$i]['type'] = $vv;
				$dat[$i]['m_type'] = $arr2[$kk];
				$dat[$i]['cal'] = $vs[$kk];//选择的值
				$dat[$i]['pour'] = $pr[$kk];//买了几注
				$dat[$i]['unit'] = $un[$kk];//单位
				$dat[$i]['touzhu_money'] = $touzhu[$k];//每期投注金额
				$dat[$i]['zhong_money'] = $be[$k] * $zh[$kk];//可中金额
				$i++;
			}
		}
		$ress = M("zhui_ssc_detail")->addAll($dat);
		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,kl8")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("kl8")->find();//上级返点
						$momm = (($c1['kl8'] - $cc['kl8']) / 100) * $search['moneys'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['moneys'];
				$cp['ky_money'] = $mm['money'] - $search['moneys'];
				$cp['ctime'] = time();
				$cp['typ'] = '1';
				$cp['cid'] = $ids;
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function kl8_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("kl8")->find();
		$res = M("rebate_kl8")->find();
		$kl8 = array(
			($lv['kl8']-0)*0.08+$res['rx1'],
			($lv['kl8']-0)*0.33+$res['rx2'],
			($lv['kl8']-0)*1.44+$res['rx3mid3'],
			($lv['kl8']-0)*0.14+$res['rx3mid2'],
			($lv['kl8']-0)*6.53+$res['rx4mid4'],
			($lv['kl8']-0)*0.46+$res['rx4mid3'],
			($lv['kl8']-0)*0.09+$res['rx4mid2'],
			($lv['kl8']-0)*31.01+$res['rx5mid5'],
			($lv['kl8']-0)*1.65+$res['rx5mid4'],
			($lv['kl8']-0)*0.24+$res['rx5mid3'],
			($lv['kl8']-0)*155.06+$res['rx6mid6'],
			($lv['kl8']-0)*6.46+$res['rx6mid5'],
			($lv['kl8']-0)*0.70+$res['rx6mid4'],
			($lv['kl8']-0)*0.15+$res['rx6mid3'],
			($lv['kl8']-0)*819.58+$res['rx7mid7'],
			($lv['kl8']-0)*27.32+$res['rx7mid6'],
			($lv['kl8']-0)*2.32+$res['rx7mid5'],
			($lv['kl8']-0)*0.38+$res['rx7mid4'],
			($lv['kl8']-0)*0.17+$res['rx7mid0'],
			($lv['kl8']-0)*0.05+$res['qwsx'],
			($lv['kl8']-0)*0.10+$res['qwsxhe'],
			($lv['kl8']-0)*0.05+$res['qwjo'],
			($lv['kl8']-0)*0.10+$res['qwjohe'],
			($lv['kl8']-0)*0.08+$res['qwhezhi']
		);
		$this->assign("kl8",$kl8);
	}
	public function get_kl8res(){
		$kaij = I("kaij");
		$arr = $this->get_data2("bjkl8");
		$arr[0]['ooc'] = str_replace("+",",",$arr[0]['opencode']);
		$arr[0]['opencode'] = substr($arr[0]['opencode'],0,15)."..";
		$arr[0]['cod'] = explode(",",substr($arr[0]['ooc'],0,59));

		if($arr[0]['expect']==trim($kaij)&&!empty($arr[0]['opencode'])){
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	public function get_pk10res(){
		$kaij = I("kaij");
		$arr = $this->get_data2("bjpk10");
		$arr[0]['ooc'] = substr($arr[0]['opencode'],0,15)."..";
		$arr[0]['cod'] = explode(",",$arr[0]['opencode']);
		if($arr[0]['expect']==trim($kaij)&&!empty($arr[0]['opencode'])){
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	//快乐 8
	public function kl8(){
		$arr = $this->get_data2("bjkl8");
		$uid = $_SESSION['user_id'];
		if($uid){
			self::kl8_comm();
			$data = M('lottery_class')->where("id=20")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_kl8")->where("uid = $uid")->order("id desc")->limit(4)->select();
			$tt = $data['jian_time']*60-$data['feng_time'];
			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=20") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=20") ->save($d);
			}
			$co = explode("+",$arr[0]['ocode']['19']);
			$arr[0]['ocode']['19'] = $co[0];
			$da = M('lottery_class') ->where("id=20") ->find();
			foreach($arr as $ka=>$va){
				$arr[$ka]['ooc'] = str_replace("+",",",$va['opencode']);
			}

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	public function adds_kl8(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'issue' => trim(Admin_post('issue')),
			'lotteryclass' => '20',
			'pours' => Admin_post('pour'),
			'money' => Admin_post('money'),
			'numbers' => "TZ".date(md).time(),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['money']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['money']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',$search['money']);
			$ddd7 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd7['sheng_money']<=0){
				$dd7['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd7);
			}
		}
		$ids = M('lottery_kl8')->add($search);
		$dat = array();
		$arr = I('ren_type');
		$arr2 = I('ren_type2');
		$vs = I('cal');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong');
		foreach($arr as $k=>$v){
			$dat[$k]['lottery_kl8_id'] = $ids;
			$dat[$k]['type'] = $v;
			$dat[$k]['m_type'] = $arr2[$k];
			$dat[$k]['cal'] = $vs[$k];//选择的值
			$dat[$k]['pours'] = $pr[$k];//买了几注
			$dat[$k]['bei'] = $be[$k];//多少倍
			$dat[$k]['unit'] = $un[$k];//单位
			$dat[$k]['zo_money'] = $zh[$k];//可中金额
		}
		$ress = M("lottery_kl8_detail")->addAll($dat);
		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,kl8")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("kl8")->find();//上级返点
						$momm = (($c1['kl8'] - $cc['kl8']) / 100) * $search['money'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['money'];
				$cp['ky_money'] = $mm['money'] - $search['money'];
				$cp['ctime'] = time();
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function adds_zhui_kl8(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'numbers' => "TZ".date(md).time(),
			'start_num' => Admin_post('start_number'),
			'lotteryclass' => '20',
			'qishus' => Admin_post('qis'),
			'zhus' => Admin_post('zhus'),
			'moneys' => Admin_post('moneys'),
			'is_ting' => Admin_post('is_ting'),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['moneys']){
			echo 3;die;
		}else{

			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['moneys']);
			M('Accountsinfo')->where("userid = '{$search["uid"]}'")->setDec('sheng_money',($mm['money']-$search['money']));
			$ddd6 = M('Accountsinfo')->where("userid = '{$search["uid"]}'")->find();
			if($ddd6['sheng_money']<=0){
				$dd6['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd6);
			}
		}
		$ids = M('zhui_kl8')->add($search);
		$dat = array();
		$arr = I('ren_type');
		$arr2 = I('ren_type2');
		$vs = I('cal');
		$issue = I('issue');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong');
		$touzhu = I('touzhu');
		$i=0;
		foreach($issue as $k=>$v){
			foreach($arr as $kk=>$vv){
				$dat[$i]['zhui_kl8_id'] = $ids;
				$dat[$i]['issue'] = $v;
				$dat[$i]['bei'] = $be[$k];//多少倍
				$dat[$i]['type'] = $vv;
				$dat[$i]['m_type'] = $arr2[$kk];
				$dat[$i]['cal'] = $vs[$kk];//选择的值
				$dat[$i]['pour'] = $pr[$kk];//买了几注
				$dat[$i]['unit'] = $un[$kk];//单位
				$dat[$i]['touzhu_money'] = $touzhu[$k];//每期投注金额
				$dat[$i]['zhong_money'] = $be[$k] * $zh[$kk];//可中金额
				$i++;
			}
		}
		$ress = M("zhui_kl8_detail")->addAll($dat);
		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,kl8")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("kl8")->find();//上级返点
						$momm = (($c1['kl8'] - $cc['kl8']) / 100) * $search['moneys'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['moneys'];
				$cp['ky_money'] = $mm['money'] - $search['moneys'];
				$cp['ctime'] = time();
				$cp['typ'] = '1';
				$cp['cid'] = $ids;
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function pk10_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("pk10")->find();
		$res = M("rebate_pk10")->find();
		$pk10 = array(
			($lv['pk10']-0)*0.20+$res['dwd'],
			($lv['pk10']-0)*604.80+$res['q5fs'],
			($lv['pk10']-0)*604.80+$res['q5ds'],
			($lv['pk10']-0)*100.80+$res['q4fs'],
			($lv['pk10']-0)*100.80+$res['q4ds'],
			($lv['pk10']-0)*14.40+$res['q3fs'],
			($lv['pk10']-0)*14.40+$res['q3ds'],
			($lv['pk10']-0)*1.80+$res['q2fs'],
			($lv['pk10']-0)*1.80+$res['q2ds'],
			($lv['pk10']-0)*0.2+$res['q1fs']
		);
		$this->assign("pk10",$pk10);
	}
	//pk 10
	public function pk10(){
		$uid = $_SESSION['user_id'];
		if($uid){
			self::pk10_comm();
			$arr = $this->get_data2("bjpk10");
			$data = M('lottery_class')->where("id=21")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();
			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_pk10")->where("uid = $uid")->order("id desc")->limit(4)->select();
			$tt = $data['jian_time']*60-$data['feng_time'];
			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=21") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=21") ->save($d);
			}
			$da = M('lottery_class') ->where("id=21") ->find();
			foreach($arr as $ka=>$va){
				$arr[$ka]['ooc'] = str_replace("+",",",$va['opencode']);
			}

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	public function adds_pk10(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'issue' => trim(Admin_post('issue')),
			'lotteryclass' => '21',
			'pours' => Admin_post('pour'),
			'money' => Admin_post('money'),
			'numbers' => "TZ".date(md).time(),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['money']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['money']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',$search['money']);
			$ddd5 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd5['sheng_money']<=0){
				$dd5['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd5);
			}
		}
		$ids = M('lottery_pk10')->add($search);
		$dat = array();
		$arr = I('ty');
		$arr2 = I('fu');
		$vs = I('cal');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong_money');
		foreach($arr as $k=>$v){
			$dat[$k]['lottery_pk10_id'] = $ids;
			$dat[$k]['type'] = $v;
			$dat[$k]['m_type'] = $arr2[$k];
			$dat[$k]['cal'] = $vs[$k];//选择的值
			$dat[$k]['pours'] = $pr[$k];//买了几注
			$dat[$k]['bei'] = $be[$k];//多少倍
			$dat[$k]['unit'] = $un[$k];//单位
			$dat[$k]['zo_money'] = $zh[$k] * $be[$k];//可中金额
		}
		$ress = M("lottery_pk10_detail")->addAll($dat);
		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,pk10")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("pk10")->find();//上级返点
						$momm = (($c1['pk10'] - $cc['pk10']) / 100) * $search['money'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['money'];
				$cp['ky_money'] = $mm['money'] - $search['money'];
				$cp['ctime'] = time();
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function adds_zhui_PK10(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'numbers' => "TZ".date(md).time(),
			'start_num' => Admin_post('start_number'),
			'lotteryclass' => '21',
			'qishus' => Admin_post('qis'),
			'zhus' => Admin_post('zhus'),
			'moneys' => Admin_post('moneys'),
			'is_ting' => Admin_post('is_ting'),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['moneys']){
			echo 3;die;
		}else{

//			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['moneys']);
//			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',($mm['money']-$search['money']));
//			$ddd8 = M('Accountsinfo')->where("userid = '{$search["uid"]}'")->find();
//
//			if($ddd8['sheng_money']<=0){
//				$dd8['sheng_money'] = 0;
//				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd8);
//			}
//		}

			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['moneys']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',($mm['money']-$search['money']));
			$ddd4 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd4['sheng_money']<=0){
				$dd4['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd4);
			}
		}
		$ids = M('zhui_pk10')->add($search);
		$dat = array();
		$arr = I('ren_type');
		$arr2 = I('ren_type2');
		$vs = I('cal');
		$issue = I('issue');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong');
		$touzhu = I('touzhu');
		$i=0;
		foreach($issue as $k=>$v){
			foreach($arr as $kk=>$vv){
				$dat[$i]['zhui_pk10_id'] = $ids;
				$dat[$i]['issue'] = $v;
				$dat[$i]['bei'] = $be[$k];//多少倍
				$dat[$i]['type'] = $vv;
				$dat[$i]['m_type'] = $arr2[$kk];
				$dat[$i]['cal'] = $vs[$kk];//选择的值
				$dat[$i]['pour'] = $pr[$kk];//买了几注
				$dat[$i]['unit'] = $un[$kk];//单位
				$dat[$i]['touzhu_money'] = $touzhu[$k];//每期投注金额
				$dat[$i]['zhong_money'] = $be[$k] * $zh[$kk];//可中金额
				$i++;
			}
		}
		$ress = M("zhui_pk10_detail")->addAll($dat);
		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,pk10")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("pk10")->find();//上级返点
						$momm = (($c1['pk10'] - $cc['pk10']) / 100) * $search['moneys'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['moneys'];
				$cp['ky_money'] = $mm['money'] - $search['moneys'];
				$cp['ctime'] = time();
				$cp['typ'] = '1';
				$cp['cid'] = $ids;
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function x5_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("x11_5")->find();
		$res = M("rebate_syx5")->find();
		$x11 = array(
			($lv['x11_5']-0)*19.80+$res['smq3zhifs'],
			($lv['x11_5']-0)*0.16+$res['smq3zhids'],
			($lv['x11_5']-0)*3.30+$res['smq3zufs'],
			($lv['x11_5']-0)*3.30+$res['smq3zuds'],
			($lv['x11_5']-0)*3.30+$res['smq3zudt'],
			($lv['x11_5']-0)*2.20+$res['emq2zhifs'],
			($lv['x11_5']-0)*2.20+$res['emq2zhids'],
			($lv['x11_5']-0)*1.10+$res['emq2zufs'],
			($lv['x11_5']-0)*1.10+$res['emq2zuds'],
			($lv['x11_5']-0)*1.10+$res['emq2zudt'],
			($lv['x11_5']-0)*1.07+$res['q3ymbdw'],
			($lv['x11_5']-0)*0.22+$res['dwdfs'],
			($lv['x11_5']-0)*1.54+$res['d5s0'],
			($lv['x11_5']-0)*0.13+$res['d4s1'],
			($lv['x11_5']-0)*0.55+$res['d3s2'],
			($lv['x11_5']-0)*0.06+$res['d2s3'],
			($lv['x11_5']-0)*0.31+$res['d1s4'],
			($lv['x11_5']-0)*9.24+$res['d0s5'],
			($lv['x11_5']-0)*0.33+$res['mid03'],
			($lv['x11_5']-0)*0.14+$res['mid04'],
			($lv['x11_5']-0)*0.10+$res['mid05'],
			($lv['x11_5']-0)*0.09+$res['mid06'],
			($lv['x11_5']-0)*0.04+$res['rxfs1z1'],
			($lv['x11_5']-0)*0.11+$res['rxfs2z2'],
			($lv['x11_5']-0)*0.33+$res['rxfs3z3'],
			($lv['x11_5']-0)*0.04+$res['rxds1z1'],
			($lv['x11_5']-0)*1.32+$res['rxfs4z4'],
			($lv['x11_5']-0)*9.24+$res['rxfs5z5'],
			($lv['x11_5']-0)*1.54+$res['rxfs6z5'],
			($lv['x11_5']-0)*0.44+$res['rxfs7z5'],
			($lv['x11_5']-0)*0.16+$res['rxfs8z5'],
			($lv['x11_5']-0)*0.11+$res['rxds2z2'],
			($lv['x11_5']-0)*0.32+$res['rxds3z3'],
			($lv['x11_5']-0)*1.32+$res['rxds4z4'],
			($lv['x11_5']-0)*9.24+$res['rxds5z5'],
			($lv['x11_5']-0)*1.53+$res['rxds6z5'],
			($lv['x11_5']-0)*0.44+$res['rxds7z5'],
			($lv['x11_5']-0)*0.16+$res['rxds8z5'],
			($lv['x11_5']-0)*0.11+$res['rxdt2z2'],
			($lv['x11_5']-0)*0.33+$res['rxdt3z3'],
			($lv['x11_5']-0)*1.32+$res['rxdt4z4'],
			($lv['x11_5']-0)*9.24+$res['rxdt5z5'],
			($lv['x11_5']-0)*1.53+$res['rxdt6z5'],
			($lv['x11_5']-0)*0.44+$res['rxdt7z5'],
			($lv['x11_5']-0)*0.16+$res['rxdt8z5']
		);
		$this->assign("x11",$x11);
	}
	public function get_x5res(){
		$id = I("id");
		$kaij = I("kaij");
		if($id == '22'){
			$arr = $this->get_data2("gd11x5");
		}
		if($id == '23'){
			$arr = $this->get_data2("sh11x5");
		}
		if($id == '24'){
			$arr = $this->get_data2("sd11x5");
		}
		if($id == '25'){
			$arr = $this->get_data2("jx11x5");
		}
		if($arr[0]['expect']==$kaij&&!empty($arr[0]['opencode'])){
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	//广东 11选5
	public function gdx5(){
		$uid = $_SESSION['user_id'];
		if($uid){
			self::x5_comm();
			$arr = $this->get_data2("gd11x5");
			$data = M('lottery_class')->where("id=22")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();

			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_11x5")->where("uid = $uid and lotteryclass=22")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=22") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=22") ->save($d);
			}
			$da = M('lottery_class') ->where("id=22") ->find();

			$end = date("Ymd")."084";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天

			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//上海 11选5
	public function shx5(){
		$uid = $_SESSION['user_id'];
		if($uid){
			self::x5_comm();
			$arr = $this->get_data2("sh11x5");
			$data = M('lottery_class')->where("id=23")->find();
			$s1 = date("Y-m-d")." ".$data['stime'];
			$s2 = date("Y-m-d")." ".$data['etime'];
			if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
				$this->assign("state",1);
			}
			$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
			$ti = $jie-time();

			if($ti < 0){
				$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
				$ti = $jie-time();
			}
			$res = M("lottery_11x5")->where("uid = $uid and lotteryclass=23")->order("id desc")->limit(4)->select();

			$tt = $data['jian_time']*60-$data['feng_time'];

			if($ti < $tt){
				$d['coming_issue'] = $arr[0]['expect'];
				$d['current_issue'] = $arr[0]['expect']+1;
				M('lottery_class') ->where("id=23") ->save($d);
			}else{
				$d['coming_issue'] = $arr[0]['expect']+1;
				$d['current_issue'] = $arr[0]['expect']+2;
				M('lottery_class') ->where("id=23") ->save($d);
			}
			$da = M('lottery_class') ->where("id=23") ->find();
			foreach($arr as $ka=>$va){
				$arr[$ka]['ooc'] = str_replace("+",",",$va['opencode']);
			}
			$end = date("Ymd")."090";
			$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
			$str = date("Ym").$days;
			$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

			//中奖信息 begin
			$r1 = M("lottery_add la")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
				->where("la.zong_money>0")
				->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
				->select();
			$r2 = M("lottery_ssc ls")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
				->where("ls.zong_money>0")
				->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
				->select();
			$r3 = M("lottery_pk10 lp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
				->where("lp.zong_money>0")
				->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
				->select();
			$r4 = M("lottery_kl8 lk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
				->where("lk.zong_money>0")
				->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
				->select();
			$r5 = M("lottery_11x5 l1")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
				->where("l1.zong_money>0")
				->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
				->select();
			$r6 = M("lottery_fc3d lf")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
				->where("lf.zong_money>0")
				->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
				->select();
			$r7 = M("zhui_kl8 zk")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
				->where("zk.zo_money>0")
				->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
				->select();
			$r8 = M("zhui_pk10 zp")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
				->where("zp.zo_money>0")
				->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
				->select();
			$r9 = M("zhui_ssc zs")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
				->where("zs.zo_money>0")
				->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
				->select();
			$r10 = M("zhui_x5 zx")
				->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
				->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
				->where("zx.zo_money>0")
				->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
				->select();
			$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

			$tu1 = array();
			foreach($r as $kp=>$vp){
				$tu1[] = $vp['uid'];
			}
			$tuss = implode(",",$tu1);
			if($tuss){
				$where1 = "uid in($tuss)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($r as $ka1=>$va){
				$total = 0;//总
				foreach ($sum11 as $key1 => $value1) {
					if($va['uid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['uid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['uid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['uid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['uid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['uid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['uid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['uid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['uid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['uid']==$value101['uid']){
						$total+=$value101['zo_money'];
					}
				}
				$r[$ka1]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$r[$ka1]['touxie'] = $touxie;
				$r[$ka1]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$r[$ka1]['sex'] = $sex;
			}
			$age = array();
			foreach ($r as $users) {
				$age[] = $users['ctime'];
			}
			array_multisort($age, SORT_DESC, $r);

			$data1 = M("notice")->select();
			$this->assign("data1",$data1);

			$this->assign("r",$r);
			//中奖信息 end


//		昨日奖金榜 begin
			$data = M('Accountsinfo')
				->field("userid,nickname,avatar,accounts,sex,score")
				->select();
			$tu = array();
			foreach($data as $kk=>$vv){
				$tu[] = $vv['userid'];
			}
			$tus = implode(",",$tu);
			$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
			$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
			if($tus){
				$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
				$sum1 = M("lottery_add")->where($where)->select();
				$sum2 = M("lottery_ssc")->where($where)->select();
				$sum3 = M("lottery_pk10")->where($where)->select();
				$sum4 = M("lottery_kl8")->where($where)->select();
				$sum5 = M("lottery_11x5")->where($where)->select();
				$sum6 = M("lottery_fc3d")->where($where)->select();
				$sum7 = M("zhui_kl8")->where($where)->select();
				$sum8 = M("zhui_pk10")->where($where)->select();
				$sum9 = M("zhui_ssc")->where($where)->select();
				$sum10 = M("zhui_x5")->where($where)->select();
				$where1 = "uid in($tus)";
				$sum11 = M("lottery_add")->where($where1)->select();
				$sum21 = M("lottery_ssc")->where($where1)->select();
				$sum31 = M("lottery_pk10")->where($where1)->select();
				$sum41 = M("lottery_kl8")->where($where1)->select();
				$sum51 = M("lottery_11x5")->where($where1)->select();
				$sum61 = M("lottery_fc3d")->where($where1)->select();
				$sum71 = M("zhui_kl8")->where($where1)->select();
				$sum81 = M("zhui_pk10")->where($where1)->select();
				$sum91 = M("zhui_ssc")->where($where1)->select();
				$sum101 = M("zhui_x5")->where($where1)->select();
			}
			foreach($data as $ka=>$va){
				$total = 0;//总
				$zuo = 0;//昨日
				foreach ($sum1 as $key => $value) {
					if($va['userid']==$value['uid']){
						$zuo+=$value['zong_money'];
					}
				}
				foreach ($sum2 as $key2 => $value2) {
					if($va['userid']==$value2['uid']){
						$zuo+=$value2['zong_money'];
					}
				}
				foreach ($sum3 as $key3 => $value3) {
					if($va['userid']==$value3['uid']){
						$zuo+=$value3['zong_money'];
					}
				}
				foreach ($sum4 as $key4 => $value4) {
					if($va['userid']==$value4['uid']){
						$zuo+=$value4['zong_money'];
					}
				}
				foreach ($sum5 as $key5 => $value5) {
					if($va['userid']==$value5['uid']){
						$zuo+=$value5['zong_money'];
					}
				}
				foreach ($sum6 as $key6 => $value6) {
					if($va['userid']==$value6['uid']){
						$zuo+=$value6['zong_money'];
					}
				}
				foreach ($sum7 as $key7 => $value7) {
					if($va['userid']==$value7['uid']){
						$zuo+=$value7['zo_money'];
					}
				}
				foreach ($sum8 as $key8 => $value8) {
					if($va['userid']==$value8['uid']){
						$zuo+=$value8['zo_money'];
					}
				}
				foreach ($sum9 as $key9 => $value9) {
					if($va['userid']==$value9['uid']){
						$zuo+=$value9['zo_money'];
					}
				}
				foreach ($sum10 as $key10 => $value10) {
					if($va['userid']==$value10['uid']){
						$zuo+=$value10['zong_money'];
					}
				}
				foreach ($sum11 as $key1 => $value1) {
					if($va['userid']==$value1['uid']){
						$total+=$value1['zong_money'];
					}
				}
				foreach ($sum21 as $key21 => $value21) {
					if($va['userid']==$value21['uid']){
						$total+=$value21['zong_money'];
					}
				}
				foreach ($sum31 as $key31 => $value31) {
					if($va['userid']==$value31['uid']){
						$total+=$value31['zong_money'];
					}
				}
				foreach ($sum41 as $key41 => $value41) {
					if($va['userid']==$value41['uid']){
						$total+=$value41['zong_money'];
					}
				}
				foreach ($sum51 as $key51 => $value51) {
					if($va['userid']==$value51['uid']){
						$total+=$value51['zong_money'];
					}
				}
				foreach ($sum61 as $key61 => $value61) {
					if($va['userid']==$value61['uid']){
						$total+=$value61['zong_money'];
					}
				}
				foreach ($sum71 as $key71 => $value71) {
					if($va['userid']==$value71['uid']){
						$total+=$value71['zo_money'];
					}
				}
				foreach ($sum81 as $key81 => $value81) {
					if($va['userid']==$value81['uid']){
						$total+=$value81['zo_money'];
					}
				}
				foreach ($sum91 as $key91 => $value91) {
					if($va['userid']==$value91['uid']){
						$total+=$value91['zo_money'];
					}
				}
				foreach ($sum101 as $key101 => $value101) {
					if($va['userid']==$value101['uid']){
						$total+=$value101['zong_money'];
					}
				}
				$data[$ka]['zuo_money'] = $zuo;
				$data[$ka]['total'] = $total;
				if($va['score'] < '10'){
					$touxie = 'VIP1';
					$zhiw = "农民";
				}elseif('10' <= $va['score'] && $va['score'] < '200'){
					$touxie = 'VIP2';
					$zhiw = "地主";
				}elseif('200' <= $va['score'] && $va['score'] < '1000'){
					$touxie = 'VIP3';
					$zhiw = "知县";
				}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
					$touxie = 'VIP4';
					$zhiw = "通判";
				}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
					$touxie = 'VIP5';
					$zhiw = "知府";
				}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
					$touxie = 'VIP6';
					$zhiw = "总督";
				}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
					$touxie = 'VIP7';
					$zhiw = "巡抚";
				}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
					$touxie = 'VIP8';
					$zhiw = "丞相";
				}elseif('5000000' <= $va['score']){
					$touxie = 'VIP9';
					$zhiw = "帝王";
				}
				$data[$ka]['touxie'] = $touxie;
				$data[$ka]['zhiw'] = $zhiw;
				if($va['sex']=='1'){
					$sex = "男";
				}if($va['sex']=='2'){
					$sex = "女";
				}if($va['sex']=='3'){
					$sex = "保密";
				}
				$data[$ka]['sex'] = $sex;
			}
			$ages = array();
			foreach ($data as $user) {
				$ages[] = $user['zuo_money'];
			}
			array_multisort($ages, SORT_DESC, $data);
			$da1 = array_slice($data,0,10);
			$this->assign("da",$da1);
//昨日奖金榜 end

			$this->assign("end",$end);//最后一期
			$this->assign("str",$str);//月底
			$this->assign("ming",$ming);//明天
			$this->assign("ti",$ti);
			$this->assign("arr",$arr);
			$this->assign("res",$res);
			$this->assign("dat",$da);
			$this->display();
		}
	}
	//山东 11选5
	public function sdx5(){
		self::x5_comm();
		$arr = $this->get_data2("sd11x5");
		$uid = $_SESSION['user_id'];
		$data = M('lottery_class')->where("id=24")->find();
		$s1 = date("Y-m-d")." ".$data['stime'];
		$s2 = date("Y-m-d")." ".$data['etime'];
		if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
			$this->assign("state",1);
		}
		$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
		$ti = $jie-time();

		if($ti < 0){
			$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
			$ti = $jie-time();
		}
		$res = M("lottery_11x5")->where("uid = $uid and lotteryclass=24")->order("id desc")->limit(4)->select();

		$tt = $data['jian_time']*60-$data['feng_time'];

		if($ti < $tt){
			$d['coming_issue'] = $arr[0]['expect'];
			$d['current_issue'] = $arr[0]['expect']+1;
			M('lottery_class') ->where("id=24") ->save($d);
		}else{
			$d['coming_issue'] = $arr[0]['expect']+1;
			$d['current_issue'] = $arr[0]['expect']+2;
			M('lottery_class') ->where("id=24") ->save($d);
		}
		$da = M('lottery_class') ->where("id=24") ->find();
		foreach($arr as $ka=>$va){
			$arr[$ka]['ooc'] = str_replace("+",",",$va['opencode']);
		}
		$end = date("Ymd")."087";
		$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
		$str = date("Ym").$days;
		$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

		//中奖信息 begin
		$r1 = M("lottery_add la")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
			->where("la.zong_money>0")
			->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
			->select();
		$r2 = M("lottery_ssc ls")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
			->where("ls.zong_money>0")
			->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
			->select();
		$r3 = M("lottery_pk10 lp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
			->where("lp.zong_money>0")
			->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
			->select();
		$r4 = M("lottery_kl8 lk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
			->where("lk.zong_money>0")
			->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
			->select();
		$r5 = M("lottery_11x5 l1")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
			->where("l1.zong_money>0")
			->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
			->select();
		$r6 = M("lottery_fc3d lf")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
			->where("lf.zong_money>0")
			->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
			->select();
		$r7 = M("zhui_kl8 zk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
			->where("zk.zo_money>0")
			->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
			->select();
		$r8 = M("zhui_pk10 zp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
			->where("zp.zo_money>0")
			->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
			->select();
		$r9 = M("zhui_ssc zs")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
			->where("zs.zo_money>0")
			->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
			->select();
		$r10 = M("zhui_x5 zx")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
			->where("zx.zo_money>0")
			->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
			->select();
		$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

		$tu1 = array();
		foreach($r as $kp=>$vp){
			$tu1[] = $vp['uid'];
		}
		$tuss = implode(",",$tu1);
		if($tuss){
			$where1 = "uid in($tuss)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($r as $ka1=>$va){
			$total = 0;//总
			foreach ($sum11 as $key1 => $value1) {
				if($va['uid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['uid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['uid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['uid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['uid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['uid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['uid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['uid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['uid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['uid']==$value101['uid']){
					$total+=$value101['zo_money'];
				}
			}
			$r[$ka1]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$r[$ka1]['touxie'] = $touxie;
			$r[$ka1]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$r[$ka1]['sex'] = $sex;
		}
		$age = array();
		foreach ($r as $users) {
			$age[] = $users['ctime'];
		}
		array_multisort($age, SORT_DESC, $r);

		$data1 = M("notice")->select();
		$this->assign("data1",$data1);

		$this->assign("r",$r);
		//中奖信息 end


//		昨日奖金榜 begin
		$data = M('Accountsinfo')
			->field("userid,nickname,avatar,accounts,sex,score")
			->select();
		$tu = array();
		foreach($data as $kk=>$vv){
			$tu[] = $vv['userid'];
		}
		$tus = implode(",",$tu);
		$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
		$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
		if($tus){
			$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
			$sum1 = M("lottery_add")->where($where)->select();
			$sum2 = M("lottery_ssc")->where($where)->select();
			$sum3 = M("lottery_pk10")->where($where)->select();
			$sum4 = M("lottery_kl8")->where($where)->select();
			$sum5 = M("lottery_11x5")->where($where)->select();
			$sum6 = M("lottery_fc3d")->where($where)->select();
			$sum7 = M("zhui_kl8")->where($where)->select();
			$sum8 = M("zhui_pk10")->where($where)->select();
			$sum9 = M("zhui_ssc")->where($where)->select();
			$sum10 = M("zhui_x5")->where($where)->select();
			$where1 = "uid in($tus)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($data as $ka=>$va){
			$total = 0;//总
			$zuo = 0;//昨日
			foreach ($sum1 as $key => $value) {
				if($va['userid']==$value['uid']){
					$zuo+=$value['zong_money'];
				}
			}
			foreach ($sum2 as $key2 => $value2) {
				if($va['userid']==$value2['uid']){
					$zuo+=$value2['zong_money'];
				}
			}
			foreach ($sum3 as $key3 => $value3) {
				if($va['userid']==$value3['uid']){
					$zuo+=$value3['zong_money'];
				}
			}
			foreach ($sum4 as $key4 => $value4) {
				if($va['userid']==$value4['uid']){
					$zuo+=$value4['zong_money'];
				}
			}
			foreach ($sum5 as $key5 => $value5) {
				if($va['userid']==$value5['uid']){
					$zuo+=$value5['zong_money'];
				}
			}
			foreach ($sum6 as $key6 => $value6) {
				if($va['userid']==$value6['uid']){
					$zuo+=$value6['zong_money'];
				}
			}
			foreach ($sum7 as $key7 => $value7) {
				if($va['userid']==$value7['uid']){
					$zuo+=$value7['zo_money'];
				}
			}
			foreach ($sum8 as $key8 => $value8) {
				if($va['userid']==$value8['uid']){
					$zuo+=$value8['zo_money'];
				}
			}
			foreach ($sum9 as $key9 => $value9) {
				if($va['userid']==$value9['uid']){
					$zuo+=$value9['zo_money'];
				}
			}
			foreach ($sum10 as $key10 => $value10) {
				if($va['userid']==$value10['uid']){
					$zuo+=$value10['zong_money'];
				}
			}
			foreach ($sum11 as $key1 => $value1) {
				if($va['userid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['userid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['userid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['userid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['userid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['userid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['userid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['userid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['userid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['userid']==$value101['uid']){
					$total+=$value101['zong_money'];
				}
			}
			$data[$ka]['zuo_money'] = $zuo;
			$data[$ka]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$data[$ka]['touxie'] = $touxie;
			$data[$ka]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$data[$ka]['sex'] = $sex;
		}
		$ages = array();
		foreach ($data as $user) {
			$ages[] = $user['zuo_money'];
		}
		array_multisort($ages, SORT_DESC, $data);
		$da1 = array_slice($data,0,10);
		$this->assign("da",$da1);
//昨日奖金榜 end

		$this->assign("end",$end);//最后一期
		$this->assign("str",$str);//月底
		$this->assign("ming",$ming);//明天

		$this->assign("ti",$ti);
		$this->assign("arr",$arr);
		$this->assign("res",$res);
		$this->assign("dat",$da);
		$this->display();
	}
	//江西 11选5
	public function jxx5(){
		self::x5_comm();
		$arr = $this->get_data2("jx11x5");
		$uid = $_SESSION['user_id'];
		$data = M('lottery_class')->where("id=25")->find();
		$s1 = date("Y-m-d")." ".$data['stime'];
		$s2 = date("Y-m-d")." ".$data['etime'];
		if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
			$this->assign("state",1);
		}
		$jie = $data['opentimestamp']+$data['jian_time']*60-$data['feng_time'];
		$ti = $jie-time();

		if($ti < 0){
			$jie = $data['opentimestamp']+$data['jian_time']*60*2-$data['feng_time'];
			$ti = $jie-time();
		}
		$res = M("lottery_11x5")->where("uid = $uid and lotteryclass=25")->order("id desc")->limit(4)->select();

		$tt = $data['jian_time']*60-$data['feng_time'];

		if($ti < $tt){
			$d['coming_issue'] = $arr[0]['expect'];
			$d['current_issue'] = $arr[0]['expect']+1;
			M('lottery_class') ->where("id=25") ->save($d);
		}else{
			$d['coming_issue'] = $arr[0]['expect']+1;
			$d['current_issue'] = $arr[0]['expect']+2;
			M('lottery_class') ->where("id=25") ->save($d);
		}
		$da = M('lottery_class') ->where("id=25") ->find();
		foreach($arr as $ka=>$va){
			$arr[$ka]['ooc'] = str_replace("+",",",$va['opencode']);
		}
		$end = date("Ymd")."087";
		$days = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
		$str = date("Ym").$days;
		$ming = date("Y-m-d",(strtotime(date("Y-m-").$days) + 3600*24));

		//中奖信息 begin
		$r1 = M("lottery_add la")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
			->where("la.zong_money>0")
			->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
			->select();
		$r2 = M("lottery_ssc ls")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
			->where("ls.zong_money>0")
			->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
			->select();
		$r3 = M("lottery_pk10 lp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
			->where("lp.zong_money>0")
			->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
			->select();
		$r4 = M("lottery_kl8 lk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
			->where("lk.zong_money>0")
			->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
			->select();
		$r5 = M("lottery_11x5 l1")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
			->where("l1.zong_money>0")
			->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
			->select();
		$r6 = M("lottery_fc3d lf")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
			->where("lf.zong_money>0")
			->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
			->select();
		$r7 = M("zhui_kl8 zk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
			->where("zk.zo_money>0")
			->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
			->select();
		$r8 = M("zhui_pk10 zp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
			->where("zp.zo_money>0")
			->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
			->select();
		$r9 = M("zhui_ssc zs")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
			->where("zs.zo_money>0")
			->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
			->select();
		$r10 = M("zhui_x5 zx")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
			->where("zx.zo_money>0")
			->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
			->select();
		$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

		$tu1 = array();
		foreach($r as $kp=>$vp){
			$tu1[] = $vp['uid'];
		}
		$tuss = implode(",",$tu1);
		if($tuss){
			$where1 = "uid in($tuss)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($r as $ka1=>$va){
			$total = 0;//总
			foreach ($sum11 as $key1 => $value1) {
				if($va['uid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['uid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['uid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['uid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['uid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['uid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['uid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['uid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['uid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['uid']==$value101['uid']){
					$total+=$value101['zo_money'];
				}
			}
			$r[$ka1]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$r[$ka1]['touxie'] = $touxie;
			$r[$ka1]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$r[$ka1]['sex'] = $sex;
		}
		$age = array();
		foreach ($r as $users) {
			$age[] = $users['ctime'];
		}
		array_multisort($age, SORT_DESC, $r);

		$data1 = M("notice")->select();
		$this->assign("data1",$data1);

		$this->assign("r",$r);
		//中奖信息 end


//		昨日奖金榜 begin
		$data = M('Accountsinfo')
			->field("userid,nickname,avatar,accounts,sex,score")
			->select();
		$tu = array();
		foreach($data as $kk=>$vv){
			$tu[] = $vv['userid'];
		}
		$tus = implode(",",$tu);
		$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
		$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
		if($tus){
			$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
			$sum1 = M("lottery_add")->where($where)->select();
			$sum2 = M("lottery_ssc")->where($where)->select();
			$sum3 = M("lottery_pk10")->where($where)->select();
			$sum4 = M("lottery_kl8")->where($where)->select();
			$sum5 = M("lottery_11x5")->where($where)->select();
			$sum6 = M("lottery_fc3d")->where($where)->select();
			$sum7 = M("zhui_kl8")->where($where)->select();
			$sum8 = M("zhui_pk10")->where($where)->select();
			$sum9 = M("zhui_ssc")->where($where)->select();
			$sum10 = M("zhui_x5")->where($where)->select();
			$where1 = "uid in($tus)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($data as $ka=>$va){
			$total = 0;//总
			$zuo = 0;//昨日
			foreach ($sum1 as $key => $value) {
				if($va['userid']==$value['uid']){
					$zuo+=$value['zong_money'];
				}
			}
			foreach ($sum2 as $key2 => $value2) {
				if($va['userid']==$value2['uid']){
					$zuo+=$value2['zong_money'];
				}
			}
			foreach ($sum3 as $key3 => $value3) {
				if($va['userid']==$value3['uid']){
					$zuo+=$value3['zong_money'];
				}
			}
			foreach ($sum4 as $key4 => $value4) {
				if($va['userid']==$value4['uid']){
					$zuo+=$value4['zong_money'];
				}
			}
			foreach ($sum5 as $key5 => $value5) {
				if($va['userid']==$value5['uid']){
					$zuo+=$value5['zong_money'];
				}
			}
			foreach ($sum6 as $key6 => $value6) {
				if($va['userid']==$value6['uid']){
					$zuo+=$value6['zong_money'];
				}
			}
			foreach ($sum7 as $key7 => $value7) {
				if($va['userid']==$value7['uid']){
					$zuo+=$value7['zo_money'];
				}
			}
			foreach ($sum8 as $key8 => $value8) {
				if($va['userid']==$value8['uid']){
					$zuo+=$value8['zo_money'];
				}
			}
			foreach ($sum9 as $key9 => $value9) {
				if($va['userid']==$value9['uid']){
					$zuo+=$value9['zo_money'];
				}
			}
			foreach ($sum10 as $key10 => $value10) {
				if($va['userid']==$value10['uid']){
					$zuo+=$value10['zong_money'];
				}
			}
			foreach ($sum11 as $key1 => $value1) {
				if($va['userid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['userid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['userid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['userid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['userid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['userid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['userid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['userid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['userid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['userid']==$value101['uid']){
					$total+=$value101['zong_money'];
				}
			}
			$data[$ka]['zuo_money'] = $zuo;
			$data[$ka]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$data[$ka]['touxie'] = $touxie;
			$data[$ka]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$data[$ka]['sex'] = $sex;
		}
		$ages = array();
		foreach ($data as $user) {
			$ages[] = $user['zuo_money'];
		}
		array_multisort($ages, SORT_DESC, $data);
		$da1 = array_slice($data,0,10);
		$this->assign("da",$da1);
//昨日奖金榜 end

		$this->assign("end",$end);//最后一期
		$this->assign("str",$str);//月底
		$this->assign("ming",$ming);//明天
		$this->assign("ti",$ti);
		$this->assign("arr",$arr);
		$this->assign("res",$res);
		$this->assign("dat",$da);
		$this->display();
	}
	public function x5_add(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'lotteryclass' => Admin_post('lottery_class_id'),
			'issue' => trim(Admin_post('issue')),
			'pour' => Admin_post('pour'),
			'money' => Admin_post('money'),
			'numbers' => "TZ".date(md).time(),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['money']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['money']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',$search['money']);
			$ddd3 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd3['sheng_money']<=0){
				$dd3['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd3);
			}
		}
		$ids = M('lottery_11x5')->add($search);
		$dat = array();
		$arr = I('type1');
		$arr2 = I('type2');
		$vs = I('cal');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong_money');
		foreach($arr as $k=>$v){
			$dat[$k]['lottery_11x5_id'] = $ids;
			$dat[$k]['type'] = $v;
			$dat[$k]['m_type'] = $arr2[$k];
			$dat[$k]['cal'] = $vs[$k];
			$dat[$k]['pours'] = $pr[$k];
			$dat[$k]['bei'] = $be[$k];
			$dat[$k]['unit'] = $un[$k];
			$dat[$k]['zo_money'] = $zh[$k] * $be[$k];
		}
		$re = M("lottery_11x5_detail")->addAll($dat);
		if($re){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,x11_5")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("x11_5")->find();//上级返点
						$momm = (($c1['x11_5'] - $cc['x11_5']) / 100) * $search['money'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['money'];
				$cp['ky_money'] = $mm['money'] - $search['money'];
				$cp['ctime'] = time();
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function adds_zhui_x5(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'numbers' => "TZ".date(md).time(),
			'start_num' => Admin_post('start_number'),
			'lotteryclass' => Admin_post('lotteryclass'),
			'qishus' => Admin_post('qis'),
			'zhus' => Admin_post('zhus'),
			'moneys' => Admin_post('moneys'),
			'is_ting' => Admin_post('is_ting'),
			'z_type' => Admin_post('ch'),
			'lv1' => Admin_post('lv1'),
			'lv2_qi' => Admin_post('lv2_qi'),
			'lv2' => Admin_post('lv2'),
			'lv3' => Admin_post('lv3'),
			'z_type2' => Admin_post('z_type2'),
			'ctime' => time()
		);
		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['moneys']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['moneys']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',($mm['money']-$search['money']));
			$ddd2 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd2['sheng_money']<=0){
				$dd2['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd2);
			}
		}
		$ids = M('zhui_x5')->add($search);
		$dat = array();
		$arr = I('ren_type');
		$arr2 = I('ren_type2');
		$vs = I('cal');
		$issue = I('issue');
		$pr = I('pours');
		$be = I('bei');
		$un = I('unit');
		$zh = I('zhong');
		$touzhu = I('touzhu');
		$i=0;
		foreach($issue as $k=>$v){
			foreach($arr as $kk=>$vv){
				$dat[$i]['zhui_x5_id'] = $ids;
				$dat[$i]['issue'] = $v;
				$dat[$i]['bei'] = $be[$k];//多少倍
				$dat[$i]['type'] = $vv;
				$dat[$i]['m_type'] = $arr2[$kk];
				$dat[$i]['cal'] = $vs[$kk];//选择的值
				$dat[$i]['pour'] = $pr[$kk];//买了几注
				$dat[$i]['unit'] = $un[$kk];//单位
				$dat[$i]['touzhu_money'] = $touzhu[$k];//每期投注金额
				$dat[$i]['zhong_money'] = $be[$k] * $zh[$kk];//可中金额
				$i++;
			}
		}
		$ress = M("zhui_x5_detail")->addAll($dat);
		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,x11_5")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;) {
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("x11_5")->find();//上级返点
						$momm = (($c1['x11_5'] - $cc['x11_5']) / 100) * $search['moneys'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['moneys'];
				$cp['ky_money'] = $mm['money'] - $search['moneys'];
				$cp['ctime'] = time();
				$cp['typ'] = '1';
				$cp['cid'] = $ids;
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}

	public function fc3d_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("fc3d")->find();
		$res = M("rebate_fc3d")->find();
		$fc3d = array(
			($lv['fc3d']-0)*0.08+$res['daxiao'],
			($lv['fc3d']-0)*0.20+$res['yxfs'],
			($lv['fc3d']-0)*2.00+$res['hou2zhix'],
			($lv['fc3d']-0)*1.00+$res['hou2zux'],
			($lv['fc3d']-0)*2.00+$res['qian2zhix'],
			($lv['fc3d']-0)*1.00+$res['qian2zux'],
			($lv['fc3d']-0)*20.00+$res['sxingzhix'],
			($lv['fc3d']-0)*6.66+$res['sxingzux'],
			($lv['fc3d']-0)*6.66+$res['sxingzu3'],
			($lv['fc3d']-0)*3.33+$res['sxingzu6'],
			($lv['fc3d']-0)*6.66+$res['sxinghunhe'],
			($lv['fc3d']-0)*6.66+$res['sxingbd'],
			($lv['fc3d']-0)*6.66+$res['sxingzu3ds'],
			($lv['fc3d']-0)*3.33+$res['sxingzu6ds'],
			($lv['fc3d']-0)*0.07+$res['sxingyima'],
			($lv['fc3d']-0)*0.37+$res['sxingerma']
		);
		$this->assign("fc3d",$fc3d);
	}
	public function get_fc3dres(){
		$kaij = I("kaij");
		$arr = $this->get_data2("fc3d");
		$arr[0]['cod'] = explode(",",$arr[0]['opencode']);
		if($arr[0]['expect']==trim($kaij)&&!empty($arr[0]['opencode'])){
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	//福彩3D
	public function fc3d(){
		$arr = $this->get_data2("fc3d");
		$uid = $_SESSION['user_id'];
		self::fc3d_comm();
		$data = M('lottery_class')->where("id=26")->find();
		$s1 = date("Y-m-d")." ".$data['stime'];
		$s2 = date("Y-m-d")." ".$data['etime'];
		if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
			$this->assign("state",1);
			$d['coming_issue'] = $arr[0]['expect']+1;
			$d['current_issue'] = $arr[0]['expect']+2;
			M('lottery_class') ->where("id=26") ->save($d);
		}else{
			$d['coming_issue'] = $arr[0]['expect'];
			$d['current_issue'] = $arr[0]['expect']+1;
			M('lottery_class') ->where("id=26") ->save($d);
		}
		$res = M("lottery_fc3d")->where("uid = $uid")->order("id desc")->limit(4)->select();
		$da = M('lottery_class') ->where("id=26") ->find();

		//中奖信息 begin
		$r1 = M("lottery_add la")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
			->where("la.zong_money>0")
			->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
			->select();
		$r2 = M("lottery_ssc ls")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
			->where("ls.zong_money>0")
			->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
			->select();
		$r3 = M("lottery_pk10 lp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
			->where("lp.zong_money>0")
			->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
			->select();
		$r4 = M("lottery_kl8 lk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
			->where("lk.zong_money>0")
			->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
			->select();
		$r5 = M("lottery_11x5 l1")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
			->where("l1.zong_money>0")
			->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
			->select();
		$r6 = M("lottery_fc3d lf")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
			->where("lf.zong_money>0")
			->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
			->select();
		$r7 = M("zhui_kl8 zk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
			->where("zk.zo_money>0")
			->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
			->select();
		$r8 = M("zhui_pk10 zp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
			->where("zp.zo_money>0")
			->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
			->select();
		$r9 = M("zhui_ssc zs")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
			->where("zs.zo_money>0")
			->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
			->select();
		$r10 = M("zhui_x5 zx")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
			->where("zx.zo_money>0")
			->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
			->select();
		$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

		$tu1 = array();
		foreach($r as $kp=>$vp){
			$tu1[] = $vp['uid'];
		}
		$tuss = implode(",",$tu1);
		if($tuss){
			$where1 = "uid in($tuss)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($r as $ka1=>$va){
			$total = 0;//总
			foreach ($sum11 as $key1 => $value1) {
				if($va['uid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['uid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['uid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['uid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['uid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['uid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['uid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['uid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['uid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['uid']==$value101['uid']){
					$total+=$value101['zo_money'];
				}
			}
			$r[$ka1]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$r[$ka1]['touxie'] = $touxie;
			$r[$ka1]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$r[$ka1]['sex'] = $sex;
		}
		$age = array();
		foreach ($r as $users) {
			$age[] = $users['ctime'];
		}
		array_multisort($age, SORT_DESC, $r);

		$data1 = M("notice")->select();
		$this->assign("data1",$data1);

		$this->assign("r",$r);
		//中奖信息 end


//		昨日奖金榜 begin
		$data = M('Accountsinfo')
			->field("userid,nickname,avatar,accounts,sex,score")
			->select();
		$tu = array();
		foreach($data as $kk=>$vv){
			$tu[] = $vv['userid'];
		}
		$tus = implode(",",$tu);
		$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
		$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
		if($tus){
			$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
			$sum1 = M("lottery_add")->where($where)->select();
			$sum2 = M("lottery_ssc")->where($where)->select();
			$sum3 = M("lottery_pk10")->where($where)->select();
			$sum4 = M("lottery_kl8")->where($where)->select();
			$sum5 = M("lottery_11x5")->where($where)->select();
			$sum6 = M("lottery_fc3d")->where($where)->select();
			$sum7 = M("zhui_kl8")->where($where)->select();
			$sum8 = M("zhui_pk10")->where($where)->select();
			$sum9 = M("zhui_ssc")->where($where)->select();
			$sum10 = M("zhui_x5")->where($where)->select();
			$where1 = "uid in($tus)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($data as $ka=>$va){
			$total = 0;//总
			$zuo = 0;//昨日
			foreach ($sum1 as $key => $value) {
				if($va['userid']==$value['uid']){
					$zuo+=$value['zong_money'];
				}
			}
			foreach ($sum2 as $key2 => $value2) {
				if($va['userid']==$value2['uid']){
					$zuo+=$value2['zong_money'];
				}
			}
			foreach ($sum3 as $key3 => $value3) {
				if($va['userid']==$value3['uid']){
					$zuo+=$value3['zong_money'];
				}
			}
			foreach ($sum4 as $key4 => $value4) {
				if($va['userid']==$value4['uid']){
					$zuo+=$value4['zong_money'];
				}
			}
			foreach ($sum5 as $key5 => $value5) {
				if($va['userid']==$value5['uid']){
					$zuo+=$value5['zong_money'];
				}
			}
			foreach ($sum6 as $key6 => $value6) {
				if($va['userid']==$value6['uid']){
					$zuo+=$value6['zong_money'];
				}
			}
			foreach ($sum7 as $key7 => $value7) {
				if($va['userid']==$value7['uid']){
					$zuo+=$value7['zo_money'];
				}
			}
			foreach ($sum8 as $key8 => $value8) {
				if($va['userid']==$value8['uid']){
					$zuo+=$value8['zo_money'];
				}
			}
			foreach ($sum9 as $key9 => $value9) {
				if($va['userid']==$value9['uid']){
					$zuo+=$value9['zo_money'];
				}
			}
			foreach ($sum10 as $key10 => $value10) {
				if($va['userid']==$value10['uid']){
					$zuo+=$value10['zong_money'];
				}
			}
			foreach ($sum11 as $key1 => $value1) {
				if($va['userid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['userid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['userid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['userid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['userid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['userid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['userid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['userid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['userid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['userid']==$value101['uid']){
					$total+=$value101['zong_money'];
				}
			}
			$data[$ka]['zuo_money'] = $zuo;
			$data[$ka]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$data[$ka]['touxie'] = $touxie;
			$data[$ka]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$data[$ka]['sex'] = $sex;
		}
		$ages = array();
		foreach ($data as $user) {
			$ages[] = $user['zuo_money'];
		}
		array_multisort($ages, SORT_DESC, $data);
		$da1 = array_slice($data,0,10);
		$this->assign("da",$da1);
//昨日奖金榜 end

		$this->assign("arr",$arr);
		$this->assign("res",$res);
		$this->assign("dat",$da);
		$this->display();
	}
	public function adds_fc3d(){
		$search = array(
			'uid' => $_SESSION['user_id'],
			'lotteryclass' => Admin_post('lottery_class_id'),
			'issue' => trim(Admin_post('issue')),
			'pour' => Admin_post('pour'),
			'money' => Admin_post('money'),
			'numbers' => "TZ".date(md).time(),
			'ctime' => time()
		);

		$mm = M('Accountsinfo')->where("userid = '{$search['uid']}'")->field("yq_code,money")->find();
		if($mm['money'] < $search['money']){
			echo 3;die;
		}else{
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('money',$search['money']);
			M('Accountsinfo')->where("userid = '{$search['uid']}'")->setDec('sheng_money',$search['money']);
			$ddd1 = M('Accountsinfo')->where("userid = '{$search['uid']}'")->find();
			if($ddd1['sheng_money']<=0){
				$dd1['sheng_money'] = 0;
				M('Accountsinfo')->where("userid = '{$search['uid']}'")->save($dd1);
			}
		}
		$ids = M('lottery_fc3d')->add($search);
		$dat = array();
		$arr = I('type');
		$my = I('m_type');
		$vs = I("cal");
		$pr = I('pours');
		$bei = I('bei');
		$un = I('unit');
		$zm = I('zhong_money');
		foreach($arr as $k=>$v){
			$dat[$k]['lottery_fc3d_id'] = $ids;
			$dat[$k]['type'] = $v;
			$dat[$k]['m_type'] = $my[$k];
			$dat[$k]['cal'] = $vs[$k];//选择的值
			$dat[$k]['pours'] = $pr[$k];//
			$dat[$k]['bei'] = $bei[$k];//
			$dat[$k]['unit'] = $un[$k];
			$dat[$k]['zo_money'] = $zm[$k] * $bei[$k];
		}

		$ress = M("lottery_fc3d_detail")->addAll($dat);

		if($ress){
			if($mm['yq_code']){
				$cc = M("agent")->where("code = '{$mm['yq_code']}'")->field("uid,fc3d")->find();//上级id  我的返点
				if($cc['uid']!='0'){
					for($i=1;$i<2;){
						$tr = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("yq_code")->find();
						$c1 = M("agent")->where("code = '{$tr['yq_code']}'")->field("fc3d")->find();//上级返点
						$momm = (($c1['fc3d'] - $cc['fc3d']) / 100) * $search['money'];
						M('Accountsinfo')->where("userid = '{$cc['uid']}'")->setInc('money', $momm);//上级增加
						$yy = M('Accountsinfo')->where("userid = '{$cc['uid']}'")->field("money")->find();
						$cp1['number'] = date("Ymd") . rand(100000, 999999);
						$cp1['type'] = '4';
						$cp1['shou_money'] = $momm;
						$cp1['ky_money'] = $yy['money'];
						$cp1['ctime'] = time();
						$cp1['uid'] = $cc['uid'];
						$cp1['remark'] = '投注返点';
						M("jiaoyi")->add($cp1);
						if(!empty($c1['uid'])){
							$cc = $c1;
						}else{
							$i=2;
						}
					}
				}
				$cp['number'] = date("Ymd").rand(100000,999999);
				$cp['type'] = '3';
				$cp['zhi_money'] = $search['money'];
				$cp['ky_money'] = $mm['money'] - $search['money'];
				$cp['ctime'] = time();
				$cp['uid'] = $search['uid'];
				$cp['remark'] = '投注扣款';
				M("jiaoyi")->add($cp);
			}
			echo 1;
		}else{
			echo 0;
		}
	}
	public function pl3_comm(){
		$uid = $_SESSION['user_id'];
		$da = M('Accountsinfo')->where("userid = '{$uid}' ")->field("yq_code")->find();
		$lv = M("agent")->where("code = '{$da['yq_code']}'")->field("pl3_5")->find();
		$res = M("rebate_pl3")->find();
		$pl3 = array(
			($lv['pl3_5']-0)*0.08+$res['daxiao'],
			($lv['pl3_5']-0)*0.20+$res['yxfs'],
			($lv['pl3_5']-0)*2.00+$res['hou2zhix'],
			($lv['pl3_5']-0)*1.00+$res['hou2zux'],
			($lv['pl3_5']-0)*2.00+$res['qian2zhix'],
			($lv['pl3_5']-0)*1.00+$res['qian2zux'],
			($lv['pl3_5']-0)*20.00+$res['sxingzhix'],
			($lv['pl3_5']-0)*6.66+$res['sxingzux'],
			($lv['pl3_5']-0)*6.66+$res['sxingzu3'],
			($lv['pl3_5']-0)*3.33+$res['sxingzu6'],
			($lv['pl3_5']-0)*6.66+$res['sxinghunhe'],
			($lv['pl3_5']-0)*6.66+$res['sxingbd'],
			($lv['pl3_5']-0)*6.66+$res['sxingzu3ds'],
			($lv['pl3_5']-0)*3.33+$res['sxingzu6ds'],
			($lv['pl3_5']-0)*0.07+$res['sxingyima'],
			($lv['pl3_5']-0)*0.37+$res['sxingerma']
		);
		$this->assign("pl3",$pl3);
	}
	public function get_pl3res(){
		$kaij = I("kaij");
		$arr = $this->get_data2("pl3");
		$arr[0]['cod'] = explode(",",$arr[0]['opencode']);
		if($arr[0]['expect']==trim($kaij)&&!empty($arr[0]['opencode'])){
			echo json_encode($arr[0]);
			die;
		}else{
			echo 0;
		}
	}
	//排列3
	public function pl3(){
		$arr = $this->get_data2("pl3");
		$uid = $_SESSION['user_id'];
		self::pl3_comm();
		$data = M('lottery_class')->where("id=27")->find();
		$s1 = date("Y-m-d")." ".$data['stime'];
		$s2 = date("Y-m-d",strtotime("+1day"))." ".$data['etime'];
		if(strtotime($s1) > time() || strtotime($s2) < time()||$data['type']==1){
			$this->assign("state",1);
			$d['coming_issue'] = $arr[0]['expect']+1;
			$d['current_issue'] = $arr[0]['expect']+2;
			M('lottery_class') ->where("id=27") ->save($d);
		}else{
			$d['coming_issue'] = $arr[0]['expect'];
			$d['current_issue'] = $arr[0]['expect']+1;
			M('lottery_class') ->where("id=27") ->save($d);
		}
		$res = M("lottery_kl8")->where("uid = $uid")->order("id desc")->limit(4)->select();
		$da = M('lottery_class') ->where("id=27") ->find();

		//中奖信息 begin
		$r1 = M("lottery_add la")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on la.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on la.lotteryclass=c.id")
			->where("la.zong_money>0")
			->field("la.uid,la.lotteryclass,la.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,la.ctime,c.name")
			->select();
		$r2 = M("lottery_ssc ls")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on ls.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on ls.lotteryclass=c.id")
			->where("ls.zong_money>0")
			->field("ls.uid,ls.lotteryclass,ls.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,ls.ctime,c.name")
			->select();
		$r3 = M("lottery_pk10 lp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lp.lotteryclass=c.id")
			->where("lp.zong_money>0")
			->field("lp.uid,lp.lotteryclass,lp.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lp.ctime,c.name")
			->select();
		$r4 = M("lottery_kl8 lk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lk.lotteryclass=c.id")
			->where("lk.zong_money>0")
			->field("lk.uid,lk.lotteryclass,lk.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lk.ctime,c.name")
			->select();
		$r5 = M("lottery_11x5 l1")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on l1.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on l1.lotteryclass=c.id")
			->where("l1.zong_money>0")
			->field("l1.uid,l1.lotteryclass,l1.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,l1.ctime,c.name")
			->select();
		$r6 = M("lottery_fc3d lf")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on lf.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on lf.lotteryclass=c.id")
			->where("lf.zong_money>0")
			->field("lf.uid,lf.lotteryclass,lf.zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,lf.ctime,c.name")
			->select();
		$r7 = M("zhui_kl8 zk")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zk.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zk.lotteryclass=c.id")
			->where("zk.zo_money>0")
			->field("zk.uid,zk.lotteryclass,zk.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zk.ctime,c.name")
			->select();
		$r8 = M("zhui_pk10 zp")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zp.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zp.lotteryclass=c.id")
			->where("zp.zo_money>0")
			->field("zp.uid,zp.lotteryclass,zp.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zp.ctime,c.name")
			->select();
		$r9 = M("zhui_ssc zs")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zs.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zs.lotteryclass=c.id")
			->where("zs.zo_money>0")
			->field("zs.uid,zs.lotteryclass,zs.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zs.ctime,c.name")
			->select();
		$r10 = M("zhui_x5 zx")
			->join(" join ".C("DB_PREFIX")."accountsinfo a on zx.uid=a.userid")
			->join(" join ".C("DB_PREFIX")."lottery_class c on zx.lotteryclass=c.id")
			->where("zx.zo_money>0")
			->field("zx.uid,zx.lotteryclass,zx.zo_money as zong_money,a.sex,a.accounts,a.score,a.avatar,a.nickname,zx.ctime,c.name")
			->select();
		$r = array_merge($r1,$r2,$r3,$r4,$r5,$r6,$r7,$r8,$r9,$r10);

		$tu1 = array();
		foreach($r as $kp=>$vp){
			$tu1[] = $vp['uid'];
		}
		$tuss = implode(",",$tu1);
		if($tuss){
			$where1 = "uid in($tuss)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($r as $ka1=>$va){
			$total = 0;//总
			foreach ($sum11 as $key1 => $value1) {
				if($va['uid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['uid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['uid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['uid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['uid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['uid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['uid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['uid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['uid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['uid']==$value101['uid']){
					$total+=$value101['zo_money'];
				}
			}
			$r[$ka1]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$r[$ka1]['touxie'] = $touxie;
			$r[$ka1]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$r[$ka1]['sex'] = $sex;
		}
		$age = array();
		foreach ($r as $users) {
			$age[] = $users['ctime'];
		}
		array_multisort($age, SORT_DESC, $r);

		$data1 = M("notice")->select();
		$this->assign("data1",$data1);

		$this->assign("r",$r);
		//中奖信息 end


//		昨日奖金榜 begin
		$data = M('Accountsinfo')
			->field("userid,nickname,avatar,accounts,sex,score")
			->select();
		$tu = array();
		foreach($data as $kk=>$vv){
			$tu[] = $vv['userid'];
		}
		$tus = implode(",",$tu);
		$start = strtotime(date("Y-m-d",strtotime("-1 day"))." 00:00:00");
		$end1 = strtotime(date("Y-m-d",strtotime("-1 day"))." 23:59:59");
		if($tus){
			$where = "uid in($tus) and ctime >= $start and ctime <= $end1";
			$sum1 = M("lottery_add")->where($where)->select();
			$sum2 = M("lottery_ssc")->where($where)->select();
			$sum3 = M("lottery_pk10")->where($where)->select();
			$sum4 = M("lottery_kl8")->where($where)->select();
			$sum5 = M("lottery_11x5")->where($where)->select();
			$sum6 = M("lottery_fc3d")->where($where)->select();
			$sum7 = M("zhui_kl8")->where($where)->select();
			$sum8 = M("zhui_pk10")->where($where)->select();
			$sum9 = M("zhui_ssc")->where($where)->select();
			$sum10 = M("zhui_x5")->where($where)->select();
			$where1 = "uid in($tus)";
			$sum11 = M("lottery_add")->where($where1)->select();
			$sum21 = M("lottery_ssc")->where($where1)->select();
			$sum31 = M("lottery_pk10")->where($where1)->select();
			$sum41 = M("lottery_kl8")->where($where1)->select();
			$sum51 = M("lottery_11x5")->where($where1)->select();
			$sum61 = M("lottery_fc3d")->where($where1)->select();
			$sum71 = M("zhui_kl8")->where($where1)->select();
			$sum81 = M("zhui_pk10")->where($where1)->select();
			$sum91 = M("zhui_ssc")->where($where1)->select();
			$sum101 = M("zhui_x5")->where($where1)->select();
		}
		foreach($data as $ka=>$va){
			$total = 0;//总
			$zuo = 0;//昨日
			foreach ($sum1 as $key => $value) {
				if($va['userid']==$value['uid']){
					$zuo+=$value['zong_money'];
				}
			}
			foreach ($sum2 as $key2 => $value2) {
				if($va['userid']==$value2['uid']){
					$zuo+=$value2['zong_money'];
				}
			}
			foreach ($sum3 as $key3 => $value3) {
				if($va['userid']==$value3['uid']){
					$zuo+=$value3['zong_money'];
				}
			}
			foreach ($sum4 as $key4 => $value4) {
				if($va['userid']==$value4['uid']){
					$zuo+=$value4['zong_money'];
				}
			}
			foreach ($sum5 as $key5 => $value5) {
				if($va['userid']==$value5['uid']){
					$zuo+=$value5['zong_money'];
				}
			}
			foreach ($sum6 as $key6 => $value6) {
				if($va['userid']==$value6['uid']){
					$zuo+=$value6['zong_money'];
				}
			}
			foreach ($sum7 as $key7 => $value7) {
				if($va['userid']==$value7['uid']){
					$zuo+=$value7['zo_money'];
				}
			}
			foreach ($sum8 as $key8 => $value8) {
				if($va['userid']==$value8['uid']){
					$zuo+=$value8['zo_money'];
				}
			}
			foreach ($sum9 as $key9 => $value9) {
				if($va['userid']==$value9['uid']){
					$zuo+=$value9['zo_money'];
				}
			}
			foreach ($sum10 as $key10 => $value10) {
				if($va['userid']==$value10['uid']){
					$zuo+=$value10['zong_money'];
				}
			}
			foreach ($sum11 as $key1 => $value1) {
				if($va['userid']==$value1['uid']){
					$total+=$value1['zong_money'];
				}
			}
			foreach ($sum21 as $key21 => $value21) {
				if($va['userid']==$value21['uid']){
					$total+=$value21['zong_money'];
				}
			}
			foreach ($sum31 as $key31 => $value31) {
				if($va['userid']==$value31['uid']){
					$total+=$value31['zong_money'];
				}
			}
			foreach ($sum41 as $key41 => $value41) {
				if($va['userid']==$value41['uid']){
					$total+=$value41['zong_money'];
				}
			}
			foreach ($sum51 as $key51 => $value51) {
				if($va['userid']==$value51['uid']){
					$total+=$value51['zong_money'];
				}
			}
			foreach ($sum61 as $key61 => $value61) {
				if($va['userid']==$value61['uid']){
					$total+=$value61['zong_money'];
				}
			}
			foreach ($sum71 as $key71 => $value71) {
				if($va['userid']==$value71['uid']){
					$total+=$value71['zo_money'];
				}
			}
			foreach ($sum81 as $key81 => $value81) {
				if($va['userid']==$value81['uid']){
					$total+=$value81['zo_money'];
				}
			}
			foreach ($sum91 as $key91 => $value91) {
				if($va['userid']==$value91['uid']){
					$total+=$value91['zo_money'];
				}
			}
			foreach ($sum101 as $key101 => $value101) {
				if($va['userid']==$value101['uid']){
					$total+=$value101['zong_money'];
				}
			}
			$data[$ka]['zuo_money'] = $zuo;
			$data[$ka]['total'] = $total;
			if($va['score'] < '10'){
				$touxie = 'VIP1';
				$zhiw = "农民";
			}elseif('10' <= $va['score'] && $va['score'] < '200'){
				$touxie = 'VIP2';
				$zhiw = "地主";
			}elseif('200' <= $va['score'] && $va['score'] < '1000'){
				$touxie = 'VIP3';
				$zhiw = "知县";
			}elseif('1000' <= $va['score'] && $va['score'] < '10000'){
				$touxie = 'VIP4';
				$zhiw = "通判";
			}elseif('10000' <= $va['score'] && $va['score'] < '50000'){
				$touxie = 'VIP5';
				$zhiw = "知府";
			}elseif('50000' <= $va['score'] && $va['score'] < '250000'){
				$touxie = 'VIP6';
				$zhiw = "总督";
			}elseif('250000' <= $va['score'] && $va['score'] < '1000000'){
				$touxie = 'VIP7';
				$zhiw = "巡抚";
			}elseif('1000000' <= $va['score'] && $va['score'] < '5000000'){
				$touxie = 'VIP8';
				$zhiw = "丞相";
			}elseif('5000000' <= $va['score']){
				$touxie = 'VIP9';
				$zhiw = "帝王";
			}
			$data[$ka]['touxie'] = $touxie;
			$data[$ka]['zhiw'] = $zhiw;
			if($va['sex']=='1'){
				$sex = "男";
			}if($va['sex']=='2'){
				$sex = "女";
			}if($va['sex']=='3'){
				$sex = "保密";
			}
			$data[$ka]['sex'] = $sex;
		}
		$ages = array();
		foreach ($data as $user) {
			$ages[] = $user['zuo_money'];
		}
		array_multisort($ages, SORT_DESC, $data);
		$da1 = array_slice($data,0,10);
		$this->assign("da",$da1);
//昨日奖金榜 end


		$this->assign("arr",$arr);
		$this->assign("res",$res);
		$this->assign("dat",$da);
		$this->display();
	}
	public function get_time22(){
		$id = I("id");
		$data = M('lottery_class')->where("id=$id")->find();
		$s2 = date("Y-m-d",strtotime("+1day"))." ".$data['etime'];
		$ti = strtotime($s2) - time();
		$t = $ti * 1000;
		echo $t;
	}



	//江苏快三 走势图列表
	public function trendChart_k3_jsk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='jsk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='jsk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='jsk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//江苏快三 下载列表
	public function js_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='jsk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='jsk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='jsk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);

		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "江苏快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//安徽快三 走势图列表
	public function trendChart_k3_ahk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='ahk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='ahk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='ahk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//安徽快三 下载列表
	public function ah_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='ahk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='ahk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='ahk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "安徽快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//广西快三 走势图列表
	public function trendChart_k3_gxk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gxk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gxk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gxk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//广西快三 下载列表
	public function gx_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gxk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gxk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gxk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "广西快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//湖北快三 走势图列表
	public function trendChart_k3_hubk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='hubk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='hubk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='hubk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//湖北快三 下载列表
	public function hub_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='hubk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='hubk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='hubk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "湖北快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//北京快三 走势图列表
	public function trendChart_k3_bjk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='bjk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='bjk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='bjk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//北京快三 下载列表
	public function bj_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='bjk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='bjk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='bjk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "北京快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//河北快三 走势图列表
	public function trendChart_k3_hebk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='hebk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='hebk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='hebk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//河北快三 下载列表
	public function heb_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='hebk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='hebk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='hebk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "河北快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//甘肃快三 走势图列表
	public function trendChart_k3_gsk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gsk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gsk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gsk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//甘肃快三 下载列表
	public function gs_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gsk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gsk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gsk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "甘肃快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//上海快三 走势图列表
	public function trendChart_k3_shk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='shk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='shk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='shk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//上海快三 下载列表
	public function sh_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='shk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='shk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='shk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "上海快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//贵州快三 走势图列表
	public function trendChart_k3_gzk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gzk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gzk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gzk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//贵州快三 下载列表
	public function gz_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gzk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gzk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gzk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "贵州快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//吉林快三 走势图列表
	public function trendChart_k3_jlk3(){
		$qishu = I("qishu");

		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='jlk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='jlk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='jlk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,40);
		$rand8 = rand(1,40);
		$rand9 = rand(1,40);
		$rand10 = rand(1,40);
		$rand11 = rand(1,40);
		$rand12 = rand(1,40);
		$rand13 = rand(1,40);
		$rand14 = rand(1,40);
		$rand15 = rand(1,40);
		$rand16 = rand(1,40);
		$rand17 = rand(1,40);
		$rand18 = rand(1,40);
		$rand19 = rand(1,40);
		$rand20 = rand(1,40);
		$rand21 = rand(1,40);


		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);
		$this->assign('rand8',$rand8);
		$this->assign('rand9',$rand9);
		$this->assign('rand10',$rand10);
		$this->assign('rand11',$rand11);
		$this->assign('rand12',$rand12);
		$this->assign('rand13',$rand13);
		$this->assign('rand14',$rand14);
		$this->assign('rand15',$rand15);
		$this->assign('rand16',$rand16);
		$this->assign('rand17',$rand17);
		$this->assign('rand18',$rand18);
		$this->assign('rand19',$rand19);
		$this->assign('rand20',$rand20);
		$this->assign('rand21',$rand21);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	//吉林快三 下载列表
	public function jl_k3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='jlk3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='jlk3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='jlk3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "吉林快三报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}

	//重庆时时彩走势图列表
	public function trendChart_cqssc(){
		$qishu = I("qishu");
		$maifa = I("maifa");
		if($maifa==""){
			$maifa=1;
		}
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='cqssc'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='cqssc'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='cqssc'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$w[] = $v[0];
			$q[] = $v[2];
			$b[] = $v[4];
			$s[] = $v[6];
			$g[] = $v[8];
		}

		foreach($aa as $v){
			$ass[]= explode(',',$v);
		}

		foreach($ass as $v){
			$arrs[] = max($v)-min($v);

		}
		$qq = implode(',',$arrs);
		$this->assign("qq",$qq);

		//号码跨度
		$kua_0 = substr_count($qq,'0');
		$kua_1 = substr_count($qq,'1');
		$kua_2 = substr_count($qq,'2');
		$kua_3 = substr_count($qq,'3');
		$kua_4 = substr_count($qq,'4');
		$kua_5 = substr_count($qq,'5');
		$kua_6 = substr_count($qq,'6');
		$kua_7 = substr_count($qq,'7');
		$kua_8 = substr_count($qq,'8');
		$kua_9 = substr_count($qq,'9');


		$wan_0 = substr_count(implode(',',$w),'0');
		$wan_1 = substr_count(implode(',',$w),'1');
		$wan_2 = substr_count(implode(',',$w),'2');
		$wan_3 = substr_count(implode(',',$w),'3');
		$wan_4 = substr_count(implode(',',$w),'4');
		$wan_5 = substr_count(implode(',',$w),'5');
		$wan_6 = substr_count(implode(',',$w),'6');
		$wan_7 = substr_count(implode(',',$w),'7');
		$wan_8 = substr_count(implode(',',$w),'8');
		$wan_9 = substr_count(implode(',',$w),'9');

		$qian_0 = substr_count(implode(',',$q),'0');
		$qian_1 = substr_count(implode(',',$q),'1');
		$qian_2 = substr_count(implode(',',$q),'2');
		$qian_3 = substr_count(implode(',',$q),'3');
		$qian_4 = substr_count(implode(',',$q),'4');
		$qian_5 = substr_count(implode(',',$q),'5');
		$qian_6 = substr_count(implode(',',$q),'6');
		$qian_7 = substr_count(implode(',',$q),'7');
		$qian_8 = substr_count(implode(',',$q),'8');
		$qian_9 = substr_count(implode(',',$q),'9');

		$bai_0 = substr_count(implode(',',$b),'0');
		$bai_1 = substr_count(implode(',',$b),'1');
		$bai_2 = substr_count(implode(',',$b),'2');
		$bai_3 = substr_count(implode(',',$b),'3');
		$bai_4 = substr_count(implode(',',$b),'4');
		$bai_5 = substr_count(implode(',',$b),'5');
		$bai_6 = substr_count(implode(',',$b),'6');
		$bai_7 = substr_count(implode(',',$b),'7');
		$bai_8 = substr_count(implode(',',$b),'8');
		$bai_9 = substr_count(implode(',',$b),'9');

		$shi_0 = substr_count(implode(',',$s),'0');
		$shi_1 = substr_count(implode(',',$s),'1');
		$shi_2 = substr_count(implode(',',$s),'2');
		$shi_3 = substr_count(implode(',',$s),'3');
		$shi_4 = substr_count(implode(',',$s),'4');
		$shi_5 = substr_count(implode(',',$s),'5');
		$shi_6 = substr_count(implode(',',$s),'6');
		$shi_7 = substr_count(implode(',',$s),'7');
		$shi_8 = substr_count(implode(',',$s),'8');
		$shi_9 = substr_count(implode(',',$s),'9');

		$ge_0 = substr_count(implode(',',$g),'0');
		$ge_1 = substr_count(implode(',',$g),'1');
		$ge_2 = substr_count(implode(',',$g),'2');
		$ge_3 = substr_count(implode(',',$g),'3');
		$ge_4 = substr_count(implode(',',$g),'4');
		$ge_5 = substr_count(implode(',',$g),'5');
		$ge_6 = substr_count(implode(',',$g),'6');
		$ge_7 = substr_count(implode(',',$g),'7');
		$ge_8 = substr_count(implode(',',$g),'8');
		$ge_9 = substr_count(implode(',',$g),'9');

		$fenbu_0 = $wan_0+$qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_1 = $wan_1+$qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_2 = $wan_2+$qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_3 = $wan_3+$qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_4 = $wan_4+$qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_5 = $wan_5+$qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_6 = $wan_6+$qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_7 = $wan_7+$qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_8 = $wan_8+$qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_9 = $wan_9+$qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_0',$fenbu_0);
		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);

		$fenbu_03 = $qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_13 = $qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_23 = $qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_33 = $qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_43 = $qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_53 = $qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_63 = $qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_73 = $qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_83 = $qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_93 = $qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_03',$fenbu_03);
		$this->assign('fenbu_13',$fenbu_13);
		$this->assign('fenbu_23',$fenbu_23);
		$this->assign('fenbu_33',$fenbu_33);
		$this->assign('fenbu_43',$fenbu_43);
		$this->assign('fenbu_53',$fenbu_53);
		$this->assign('fenbu_63',$fenbu_63);
		$this->assign('fenbu_73',$fenbu_73);
		$this->assign('fenbu_83',$fenbu_83);
		$this->assign('fenbu_93',$fenbu_93);

		$fenbu_04 = $wan_0+$qian_0+$bai_0;
		$fenbu_14 = $wan_1+$qian_1+$bai_1;
		$fenbu_24 = $wan_2+$qian_2+$bai_2;
		$fenbu_34 = $wan_3+$qian_3+$bai_3;
		$fenbu_44 = $wan_4+$qian_4+$bai_4;
		$fenbu_54 = $wan_5+$qian_5+$bai_5;
		$fenbu_64 = $wan_6+$qian_6+$bai_6;
		$fenbu_74 = $wan_7+$qian_7+$bai_7;
		$fenbu_84 = $wan_8+$qian_8+$bai_8;
		$fenbu_94 = $wan_9+$qian_9+$bai_9;

		$this->assign('fenbu_04',$fenbu_04);
		$this->assign('fenbu_14',$fenbu_14);
		$this->assign('fenbu_24',$fenbu_24);
		$this->assign('fenbu_34',$fenbu_34);
		$this->assign('fenbu_44',$fenbu_44);
		$this->assign('fenbu_54',$fenbu_54);
		$this->assign('fenbu_64',$fenbu_64);
		$this->assign('fenbu_74',$fenbu_74);
		$this->assign('fenbu_84',$fenbu_84);
		$this->assign('fenbu_94',$fenbu_94);

		$fenbu_05 = $qian_0+$bai_0+$shi_0;
		$fenbu_15 = $qian_1+$bai_1+$shi_1;
		$fenbu_25 = $qian_2+$bai_2+$shi_2;
		$fenbu_35 = $qian_3+$bai_3+$shi_3;
		$fenbu_45 = $qian_4+$bai_4+$shi_4;
		$fenbu_55 = $qian_5+$bai_5+$shi_5;
		$fenbu_65 = $qian_6+$bai_6+$shi_6;
		$fenbu_75 = $qian_7+$bai_7+$shi_7;
		$fenbu_85 = $qian_8+$bai_8+$shi_8;
		$fenbu_95 = $qian_9+$bai_9+$shi_9;

		$this->assign('fenbu_05',$fenbu_05);
		$this->assign('fenbu_15',$fenbu_15);
		$this->assign('fenbu_25',$fenbu_25);
		$this->assign('fenbu_35',$fenbu_35);
		$this->assign('fenbu_45',$fenbu_45);
		$this->assign('fenbu_55',$fenbu_55);
		$this->assign('fenbu_65',$fenbu_65);
		$this->assign('fenbu_75',$fenbu_75);
		$this->assign('fenbu_85',$fenbu_85);
		$this->assign('fenbu_95',$fenbu_95);

		$fenbu_06 = $bai_0+$shi_0+$ge_0;
		$fenbu_16 = $bai_1+$shi_1+$ge_1;
		$fenbu_26 = $bai_2+$shi_2+$ge_2;
		$fenbu_36 = $bai_3+$shi_3+$ge_3;
		$fenbu_46 = $bai_4+$shi_4+$ge_4;
		$fenbu_56 = $bai_5+$shi_5+$ge_5;
		$fenbu_66 = $bai_6+$shi_6+$ge_6;
		$fenbu_76 = $bai_7+$shi_7+$ge_7;
		$fenbu_86 = $bai_8+$shi_8+$ge_8;
		$fenbu_96 = $bai_9+$shi_9+$ge_9;

		$fenbu_07 = $wan_0+$qian_0;
		$fenbu_17 = $wan_1+$qian_1;
		$fenbu_27 = $wan_2+$qian_2;
		$fenbu_37 = $wan_3+$qian_3;
		$fenbu_47 = $wan_4+$qian_4;
		$fenbu_57 = $wan_5+$qian_5;
		$fenbu_67 = $wan_6+$qian_6;
		$fenbu_77 = $wan_7+$qian_7;
		$fenbu_87 = $wan_8+$qian_8;
		$fenbu_97 = $wan_9+$qian_9;

		$this->assign('fenbu_07',$fenbu_07);
		$this->assign('fenbu_17',$fenbu_17);
		$this->assign('fenbu_27',$fenbu_27);
		$this->assign('fenbu_37',$fenbu_37);
		$this->assign('fenbu_47',$fenbu_47);
		$this->assign('fenbu_57',$fenbu_57);
		$this->assign('fenbu_67',$fenbu_67);
		$this->assign('fenbu_77',$fenbu_77);
		$this->assign('fenbu_87',$fenbu_87);
		$this->assign('fenbu_97',$fenbu_97);

		$fenbu_08 = $shi_0+$ge_0;
		$fenbu_18 = $shi_1+$ge_1;
		$fenbu_28 = $shi_2+$ge_2;
		$fenbu_38 = $shi_3+$ge_3;
		$fenbu_48 = $shi_4+$ge_4;
		$fenbu_58 = $shi_5+$ge_5;
		$fenbu_68 = $shi_6+$ge_6;
		$fenbu_78 = $shi_7+$ge_7;
		$fenbu_88 = $shi_8+$ge_8;
		$fenbu_98 = $shi_9+$ge_9;

		$this->assign('fenbu_08',$fenbu_08);
		$this->assign('fenbu_18',$fenbu_18);
		$this->assign('fenbu_28',$fenbu_28);
		$this->assign('fenbu_38',$fenbu_38);
		$this->assign('fenbu_48',$fenbu_48);
		$this->assign('fenbu_58',$fenbu_58);
		$this->assign('fenbu_68',$fenbu_68);
		$this->assign('fenbu_78',$fenbu_78);
		$this->assign('fenbu_88',$fenbu_88);
		$this->assign('fenbu_98',$fenbu_98);

		$this->assign('fenbu_06',$fenbu_06);
		$this->assign('fenbu_16',$fenbu_16);
		$this->assign('fenbu_26',$fenbu_26);
		$this->assign('fenbu_36',$fenbu_36);
		$this->assign('fenbu_46',$fenbu_46);
		$this->assign('fenbu_56',$fenbu_56);
		$this->assign('fenbu_66',$fenbu_66);
		$this->assign('fenbu_76',$fenbu_76);
		$this->assign('fenbu_86',$fenbu_86);
		$this->assign('fenbu_96',$fenbu_96);

		$this->assign('wan_9',$wan_9);
		$this->assign('wan_8',$wan_8);
		$this->assign('wan_7',$wan_7);
		$this->assign('wan_6',$wan_6);
		$this->assign('wan_5',$wan_5);
		$this->assign('wan_4',$wan_4);
		$this->assign('wan_3',$wan_3);
		$this->assign('wan_2',$wan_2);
		$this->assign('wan_1',$wan_1);
		$this->assign('wan_0',$wan_0);

		$this->assign('qian_0',$qian_0);
		$this->assign('qian_1',$qian_1);
		$this->assign('qian_2',$qian_2);
		$this->assign('qian_3',$qian_3);
		$this->assign('qian_4',$qian_4);
		$this->assign('qian_5',$qian_5);
		$this->assign('qian_6',$qian_6);
		$this->assign('qian_7',$qian_7);
		$this->assign('qian_8',$qian_8);
		$this->assign('qian_9',$qian_9);

		$this->assign('bai_0',$bai_0);
		$this->assign('bai_1',$bai_1);
		$this->assign('bai_2',$bai_2);
		$this->assign('bai_3',$bai_3);
		$this->assign('bai_4',$bai_4);
		$this->assign('bai_5',$bai_5);
		$this->assign('bai_6',$bai_6);
		$this->assign('bai_7',$bai_7);
		$this->assign('bai_8',$bai_8);
		$this->assign('bai_9',$bai_9);

		$this->assign('shi_0',$shi_0);
		$this->assign('shi_1',$shi_1);
		$this->assign('shi_2',$shi_2);
		$this->assign('shi_3',$shi_3);
		$this->assign('shi_4',$shi_4);
		$this->assign('shi_5',$shi_5);
		$this->assign('shi_6',$shi_6);
		$this->assign('shi_7',$shi_7);
		$this->assign('shi_8',$shi_8);
		$this->assign('shi_9',$shi_9);

		$this->assign('ge_0',$ge_0);
		$this->assign('ge_1',$ge_1);
		$this->assign('ge_2',$ge_2);
		$this->assign('ge_3',$ge_3);
		$this->assign('ge_4',$ge_4);
		$this->assign('ge_5',$ge_5);
		$this->assign('ge_6',$ge_6);
		$this->assign('ge_7',$ge_7);
		$this->assign('ge_8',$ge_8);
		$this->assign('ge_9',$ge_9);

		//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$w_0 = intval($zhanshi_qishu/$wan_0);
		$w_1 = intval($zhanshi_qishu/$wan_1);
		$w_2 = intval($zhanshi_qishu/$wan_2);
		$w_3 = intval($zhanshi_qishu/$wan_3);
		$w_4 = intval($zhanshi_qishu/$wan_4);
		$w_5 = intval($zhanshi_qishu/$wan_5);
		$w_6 = intval($zhanshi_qishu/$wan_6);
		$w_7 = intval($zhanshi_qishu/$wan_7);
		$w_8 = intval($zhanshi_qishu/$wan_8);
		$w_9 = intval($zhanshi_qishu/$wan_9);
		$this->assign('w_0',$w_0);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);

		$q_0 = intval($zhanshi_qishu/$qian_0);
		$q_1 = intval($zhanshi_qishu/$qian_1);
		$q_2 = intval($zhanshi_qishu/$qian_2);
		$q_3 = intval($zhanshi_qishu/$qian_3);
		$q_4 = intval($zhanshi_qishu/$qian_4);
		$q_5 = intval($zhanshi_qishu/$qian_5);
		$q_6 = intval($zhanshi_qishu/$qian_6);
		$q_7 = intval($zhanshi_qishu/$qian_7);
		$q_8 = intval($zhanshi_qishu/$qian_8);
		$q_9 = intval($zhanshi_qishu/$qian_9);
		$this->assign('q_0',$q_0);
		$this->assign('q_1',$q_1);
		$this->assign('q_2',$q_2);
		$this->assign('q_3',$q_3);
		$this->assign('q_4',$q_4);
		$this->assign('q_5',$q_5);
		$this->assign('q_6',$q_6);
		$this->assign('q_7',$q_7);
		$this->assign('q_8',$q_8);
		$this->assign('q_9',$q_9);

		$b_0 = intval($zhanshi_qishu/$bai_0);
		$b_1 = intval($zhanshi_qishu/$bai_1);
		$b_2 = intval($zhanshi_qishu/$bai_2);
		$b_3 = intval($zhanshi_qishu/$bai_3);
		$b_4 = intval($zhanshi_qishu/$bai_4);
		$b_5 = intval($zhanshi_qishu/$bai_5);
		$b_6 = intval($zhanshi_qishu/$bai_6);
		$b_7 = intval($zhanshi_qishu/$bai_7);
		$b_8 = intval($zhanshi_qishu/$bai_8);
		$b_9 = intval($zhanshi_qishu/$bai_9);
		$this->assign('b_0',$b_0);
		$this->assign('b_1',$b_1);
		$this->assign('b_2',$b_2);
		$this->assign('b_3',$b_3);
		$this->assign('b_4',$b_4);
		$this->assign('b_5',$b_5);
		$this->assign('b_6',$b_6);
		$this->assign('b_7',$b_7);
		$this->assign('b_8',$b_8);
		$this->assign('b_9',$b_9);

		$s_0 = intval($zhanshi_qishu/$shi_0);
		$s_1 = intval($zhanshi_qishu/$shi_1);
		$s_2 = intval($zhanshi_qishu/$shi_2);
		$s_3 = intval($zhanshi_qishu/$shi_3);
		$s_4 = intval($zhanshi_qishu/$shi_4);
		$s_5 = intval($zhanshi_qishu/$shi_5);
		$s_6 = intval($zhanshi_qishu/$shi_6);
		$s_7 = intval($zhanshi_qishu/$shi_7);
		$s_8 = intval($zhanshi_qishu/$shi_8);
		$s_9 = intval($zhanshi_qishu/$shi_9);
		$this->assign('s_0',$s_0);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);

		$g_0 = intval($zhanshi_qishu/$ge_0);
		$g_1 = intval($zhanshi_qishu/$ge_1);
		$g_2 = intval($zhanshi_qishu/$ge_2);
		$g_3 = intval($zhanshi_qishu/$ge_3);
		$g_4 = intval($zhanshi_qishu/$ge_4);
		$g_5 = intval($zhanshi_qishu/$ge_5);
		$g_6 = intval($zhanshi_qishu/$ge_6);
		$g_7 = intval($zhanshi_qishu/$ge_7);
		$g_8 = intval($zhanshi_qishu/$ge_8);
		$g_9 = intval($zhanshi_qishu/$ge_9);
		$this->assign('g_0',$g_0);
		$this->assign('g_1',$g_1);
		$this->assign('g_2',$g_2);
		$this->assign('g_3',$g_3);
		$this->assign('g_4',$g_4);
		$this->assign('g_5',$g_5);
		$this->assign('g_6',$g_6);
		$this->assign('g_7',$g_7);
		$this->assign('g_8',$g_8);
		$this->assign('g_9',$g_9);

		$fen_0 = intval($zhanshi_qishu/$fenbu_0);
		$fen_1 = intval($zhanshi_qishu/$fenbu_1);
		$fen_2 = intval($zhanshi_qishu/$fenbu_2);
		$fen_3 = intval($zhanshi_qishu/$fenbu_3);
		$fen_4 = intval($zhanshi_qishu/$fenbu_4);
		$fen_5 = intval($zhanshi_qishu/$fenbu_5);
		$fen_6 = intval($zhanshi_qishu/$fenbu_6);
		$fen_7 = intval($zhanshi_qishu/$fenbu_7);
		$fen_8 = intval($zhanshi_qishu/$fenbu_8);
		$fen_9 = intval($zhanshi_qishu/$fenbu_9);
		$this->assign('fen_0',$fen_0);
		$this->assign('fen_1',$fen_1);
		$this->assign('fen_2',$fen_2);
		$this->assign('fen_3',$fen_3);
		$this->assign('fen_4',$fen_4);
		$this->assign('fen_5',$fen_5);
		$this->assign('fen_6',$fen_6);
		$this->assign('fen_7',$fen_7);
		$this->assign('fen_8',$fen_8);
		$this->assign('fen_9',$fen_9);

		$fen_03 = intval($zhanshi_qishu/$fenbu_03);
		$fen_13 = intval($zhanshi_qishu/$fenbu_13);
		$fen_23 = intval($zhanshi_qishu/$fenbu_23);
		$fen_33 = intval($zhanshi_qishu/$fenbu_33);
		$fen_43 = intval($zhanshi_qishu/$fenbu_43);
		$fen_53 = intval($zhanshi_qishu/$fenbu_53);
		$fen_63 = intval($zhanshi_qishu/$fenbu_63);
		$fen_73 = intval($zhanshi_qishu/$fenbu_73);
		$fen_83 = intval($zhanshi_qishu/$fenbu_83);
		$fen_93 = intval($zhanshi_qishu/$fenbu_93);
		$this->assign('fen_03',$fen_03);
		$this->assign('fen_13',$fen_13);
		$this->assign('fen_23',$fen_23);
		$this->assign('fen_33',$fen_33);
		$this->assign('fen_43',$fen_43);
		$this->assign('fen_53',$fen_53);
		$this->assign('fen_63',$fen_63);
		$this->assign('fen_73',$fen_73);
		$this->assign('fen_83',$fen_83);
		$this->assign('fen_93',$fen_93);

		$fen_04 = intval($zhanshi_qishu/$fenbu_04);
		$fen_14 = intval($zhanshi_qishu/$fenbu_14);
		$fen_24 = intval($zhanshi_qishu/$fenbu_24);
		$fen_34 = intval($zhanshi_qishu/$fenbu_34);
		$fen_44 = intval($zhanshi_qishu/$fenbu_44);
		$fen_54 = intval($zhanshi_qishu/$fenbu_54);
		$fen_64 = intval($zhanshi_qishu/$fenbu_64);
		$fen_74 = intval($zhanshi_qishu/$fenbu_74);
		$fen_84 = intval($zhanshi_qishu/$fenbu_84);
		$fen_94 = intval($zhanshi_qishu/$fenbu_94);
		$this->assign('fen_04',$fen_04);
		$this->assign('fen_14',$fen_14);
		$this->assign('fen_24',$fen_24);
		$this->assign('fen_34',$fen_34);
		$this->assign('fen_44',$fen_44);
		$this->assign('fen_54',$fen_54);
		$this->assign('fen_64',$fen_64);
		$this->assign('fen_74',$fen_74);
		$this->assign('fen_84',$fen_84);
		$this->assign('fen_94',$fen_94);

		$fen_05 = intval($zhanshi_qishu/$fenbu_05);
		$fen_15 = intval($zhanshi_qishu/$fenbu_15);
		$fen_25 = intval($zhanshi_qishu/$fenbu_25);
		$fen_35 = intval($zhanshi_qishu/$fenbu_35);
		$fen_45 = intval($zhanshi_qishu/$fenbu_45);
		$fen_55 = intval($zhanshi_qishu/$fenbu_55);
		$fen_65 = intval($zhanshi_qishu/$fenbu_65);
		$fen_75 = intval($zhanshi_qishu/$fenbu_75);
		$fen_85 = intval($zhanshi_qishu/$fenbu_85);
		$fen_95 = intval($zhanshi_qishu/$fenbu_95);
		$this->assign('fen_05',$fen_05);
		$this->assign('fen_15',$fen_15);
		$this->assign('fen_25',$fen_25);
		$this->assign('fen_35',$fen_35);
		$this->assign('fen_45',$fen_45);
		$this->assign('fen_55',$fen_55);
		$this->assign('fen_65',$fen_65);
		$this->assign('fen_75',$fen_75);
		$this->assign('fen_85',$fen_85);
		$this->assign('fen_95',$fen_95);

		$fen_06 = intval($zhanshi_qishu/$fenbu_06);
		$fen_16 = intval($zhanshi_qishu/$fenbu_16);
		$fen_26 = intval($zhanshi_qishu/$fenbu_26);
		$fen_36 = intval($zhanshi_qishu/$fenbu_36);
		$fen_46 = intval($zhanshi_qishu/$fenbu_46);
		$fen_56 = intval($zhanshi_qishu/$fenbu_56);
		$fen_66 = intval($zhanshi_qishu/$fenbu_66);
		$fen_76 = intval($zhanshi_qishu/$fenbu_76);
		$fen_86 = intval($zhanshi_qishu/$fenbu_86);
		$fen_96 = intval($zhanshi_qishu/$fenbu_96);
		$this->assign('fen_06',$fen_06);
		$this->assign('fen_16',$fen_16);
		$this->assign('fen_26',$fen_26);
		$this->assign('fen_36',$fen_36);
		$this->assign('fen_46',$fen_46);
		$this->assign('fen_56',$fen_56);
		$this->assign('fen_66',$fen_66);
		$this->assign('fen_76',$fen_76);
		$this->assign('fen_86',$fen_86);
		$this->assign('fen_96',$fen_96);

		$fen_07 = intval($zhanshi_qishu/$fenbu_07);
		$fen_17 = intval($zhanshi_qishu/$fenbu_17);
		$fen_27 = intval($zhanshi_qishu/$fenbu_27);
		$fen_37 = intval($zhanshi_qishu/$fenbu_37);
		$fen_47 = intval($zhanshi_qishu/$fenbu_47);
		$fen_57 = intval($zhanshi_qishu/$fenbu_57);
		$fen_67 = intval($zhanshi_qishu/$fenbu_67);
		$fen_77 = intval($zhanshi_qishu/$fenbu_77);
		$fen_87 = intval($zhanshi_qishu/$fenbu_87);
		$fen_97= intval($zhanshi_qishu/$fenbu_97);
		$this->assign('fen_07',$fen_07);
		$this->assign('fen_17',$fen_17);
		$this->assign('fen_27',$fen_27);
		$this->assign('fen_37',$fen_37);
		$this->assign('fen_47',$fen_47);
		$this->assign('fen_57',$fen_57);
		$this->assign('fen_67',$fen_67);
		$this->assign('fen_77',$fen_77);
		$this->assign('fen_87',$fen_87);
		$this->assign('fen_97',$fen_97);

		$fen_08 = intval($zhanshi_qishu/$fenbu_08);
		$fen_18 = intval($zhanshi_qishu/$fenbu_18);
		$fen_28 = intval($zhanshi_qishu/$fenbu_28);
		$fen_38 = intval($zhanshi_qishu/$fenbu_38);
		$fen_48 = intval($zhanshi_qishu/$fenbu_48);
		$fen_58 = intval($zhanshi_qishu/$fenbu_58);
		$fen_68 = intval($zhanshi_qishu/$fenbu_68);
		$fen_78 = intval($zhanshi_qishu/$fenbu_78);
		$fen_88 = intval($zhanshi_qishu/$fenbu_88);
		$fen_98 = intval($zhanshi_qishu/$fenbu_98);
		$this->assign('fen_08',$fen_08);
		$this->assign('fen_18',$fen_18);
		$this->assign('fen_28',$fen_28);
		$this->assign('fen_38',$fen_38);
		$this->assign('fen_48',$fen_48);
		$this->assign('fen_58',$fen_58);
		$this->assign('fen_68',$fen_68);
		$this->assign('fen_78',$fen_78);
		$this->assign('fen_88',$fen_88);
		$this->assign('fen_98',$fen_98);

		$ku_0 = intval($zhanshi_qishu/$kua_0);
		$ku_1 = intval($zhanshi_qishu/$kua_1);
		$ku_2 = intval($zhanshi_qishu/$kua_2);
		$ku_3 = intval($zhanshi_qishu/$kua_3);
		$ku_4 = intval($zhanshi_qishu/$kua_4);
		$ku_5 = intval($zhanshi_qishu/$kua_5);
		$ku_6 = intval($zhanshi_qishu/$kua_6);
		$ku_7 = intval($zhanshi_qishu/$kua_7);
		$ku_8 = intval($zhanshi_qishu/$kua_8);
		$ku_9 = intval($zhanshi_qishu/$kua_9);
		$this->assign('ku_0',$ku_0);
		$this->assign('ku_1',$ku_1);
		$this->assign('ku_2',$ku_2);
		$this->assign('ku_3',$ku_3);
		$this->assign('ku_4',$ku_4);
		$this->assign('ku_5',$ku_5);
		$this->assign('ku_6',$ku_6);
		$this->assign('ku_7',$ku_7);
		$this->assign('ku_8',$ku_8);
		$this->assign('ku_9',$ku_9);

		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);

		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

		$this->assign('qishu',$qishu);
		$this->assign('maifa',$maifa);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function cqssc_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='cqssc'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='cqssc'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='cqssc'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "重庆时彩报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//新疆时时彩走势图列表
	public function trendChart_xjssc(){
		$qishu = I("qishu");
		$maifa = I("maifa");
		if($maifa==""){
			$maifa=1;
		}
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='xjssc'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='xjssc'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='xjssc'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$w[] = $v[0];
			$q[] = $v[2];
			$b[] = $v[4];
			$s[] = $v[6];
			$g[] = $v[8];
		}

		foreach($aa as $v){
			$ass[]= explode(',',$v);
		}

		foreach($ass as $v){
			$arrs[] = max($v)-min($v);

		}
		$qq = implode(',',$arrs);
		$this->assign("qq",$qq);

		//号码跨度
		$kua_0 = substr_count($qq,'0');
		$kua_1 = substr_count($qq,'1');
		$kua_2 = substr_count($qq,'2');
		$kua_3 = substr_count($qq,'3');
		$kua_4 = substr_count($qq,'4');
		$kua_5 = substr_count($qq,'5');
		$kua_6 = substr_count($qq,'6');
		$kua_7 = substr_count($qq,'7');
		$kua_8 = substr_count($qq,'8');
		$kua_9 = substr_count($qq,'9');


		$wan_0 = substr_count(implode(',',$w),'0');
		$wan_1 = substr_count(implode(',',$w),'1');
		$wan_2 = substr_count(implode(',',$w),'2');
		$wan_3 = substr_count(implode(',',$w),'3');
		$wan_4 = substr_count(implode(',',$w),'4');
		$wan_5 = substr_count(implode(',',$w),'5');
		$wan_6 = substr_count(implode(',',$w),'6');
		$wan_7 = substr_count(implode(',',$w),'7');
		$wan_8 = substr_count(implode(',',$w),'8');
		$wan_9 = substr_count(implode(',',$w),'9');

		$qian_0 = substr_count(implode(',',$q),'0');
		$qian_1 = substr_count(implode(',',$q),'1');
		$qian_2 = substr_count(implode(',',$q),'2');
		$qian_3 = substr_count(implode(',',$q),'3');
		$qian_4 = substr_count(implode(',',$q),'4');
		$qian_5 = substr_count(implode(',',$q),'5');
		$qian_6 = substr_count(implode(',',$q),'6');
		$qian_7 = substr_count(implode(',',$q),'7');
		$qian_8 = substr_count(implode(',',$q),'8');
		$qian_9 = substr_count(implode(',',$q),'9');

		$bai_0 = substr_count(implode(',',$b),'0');
		$bai_1 = substr_count(implode(',',$b),'1');
		$bai_2 = substr_count(implode(',',$b),'2');
		$bai_3 = substr_count(implode(',',$b),'3');
		$bai_4 = substr_count(implode(',',$b),'4');
		$bai_5 = substr_count(implode(',',$b),'5');
		$bai_6 = substr_count(implode(',',$b),'6');
		$bai_7 = substr_count(implode(',',$b),'7');
		$bai_8 = substr_count(implode(',',$b),'8');
		$bai_9 = substr_count(implode(',',$b),'9');

		$shi_0 = substr_count(implode(',',$s),'0');
		$shi_1 = substr_count(implode(',',$s),'1');
		$shi_2 = substr_count(implode(',',$s),'2');
		$shi_3 = substr_count(implode(',',$s),'3');
		$shi_4 = substr_count(implode(',',$s),'4');
		$shi_5 = substr_count(implode(',',$s),'5');
		$shi_6 = substr_count(implode(',',$s),'6');
		$shi_7 = substr_count(implode(',',$s),'7');
		$shi_8 = substr_count(implode(',',$s),'8');
		$shi_9 = substr_count(implode(',',$s),'9');

		$ge_0 = substr_count(implode(',',$g),'0');
		$ge_1 = substr_count(implode(',',$g),'1');
		$ge_2 = substr_count(implode(',',$g),'2');
		$ge_3 = substr_count(implode(',',$g),'3');
		$ge_4 = substr_count(implode(',',$g),'4');
		$ge_5 = substr_count(implode(',',$g),'5');
		$ge_6 = substr_count(implode(',',$g),'6');
		$ge_7 = substr_count(implode(',',$g),'7');
		$ge_8 = substr_count(implode(',',$g),'8');
		$ge_9 = substr_count(implode(',',$g),'9');

		$fenbu_0 = $wan_0+$qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_1 = $wan_1+$qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_2 = $wan_2+$qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_3 = $wan_3+$qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_4 = $wan_4+$qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_5 = $wan_5+$qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_6 = $wan_6+$qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_7 = $wan_7+$qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_8 = $wan_8+$qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_9 = $wan_9+$qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_0',$fenbu_0);
		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);

		$fenbu_03 = $qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_13 = $qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_23 = $qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_33 = $qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_43 = $qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_53 = $qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_63 = $qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_73 = $qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_83 = $qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_93 = $qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_03',$fenbu_03);
		$this->assign('fenbu_13',$fenbu_13);
		$this->assign('fenbu_23',$fenbu_23);
		$this->assign('fenbu_33',$fenbu_33);
		$this->assign('fenbu_43',$fenbu_43);
		$this->assign('fenbu_53',$fenbu_53);
		$this->assign('fenbu_63',$fenbu_63);
		$this->assign('fenbu_73',$fenbu_73);
		$this->assign('fenbu_83',$fenbu_83);
		$this->assign('fenbu_93',$fenbu_93);

		$fenbu_04 = $wan_0+$qian_0+$bai_0;
		$fenbu_14 = $wan_1+$qian_1+$bai_1;
		$fenbu_24 = $wan_2+$qian_2+$bai_2;
		$fenbu_34 = $wan_3+$qian_3+$bai_3;
		$fenbu_44 = $wan_4+$qian_4+$bai_4;
		$fenbu_54 = $wan_5+$qian_5+$bai_5;
		$fenbu_64 = $wan_6+$qian_6+$bai_6;
		$fenbu_74 = $wan_7+$qian_7+$bai_7;
		$fenbu_84 = $wan_8+$qian_8+$bai_8;
		$fenbu_94 = $wan_9+$qian_9+$bai_9;

		$this->assign('fenbu_04',$fenbu_04);
		$this->assign('fenbu_14',$fenbu_14);
		$this->assign('fenbu_24',$fenbu_24);
		$this->assign('fenbu_34',$fenbu_34);
		$this->assign('fenbu_44',$fenbu_44);
		$this->assign('fenbu_54',$fenbu_54);
		$this->assign('fenbu_64',$fenbu_64);
		$this->assign('fenbu_74',$fenbu_74);
		$this->assign('fenbu_84',$fenbu_84);
		$this->assign('fenbu_94',$fenbu_94);

		$fenbu_05 = $qian_0+$bai_0+$shi_0;
		$fenbu_15 = $qian_1+$bai_1+$shi_1;
		$fenbu_25 = $qian_2+$bai_2+$shi_2;
		$fenbu_35 = $qian_3+$bai_3+$shi_3;
		$fenbu_45 = $qian_4+$bai_4+$shi_4;
		$fenbu_55 = $qian_5+$bai_5+$shi_5;
		$fenbu_65 = $qian_6+$bai_6+$shi_6;
		$fenbu_75 = $qian_7+$bai_7+$shi_7;
		$fenbu_85 = $qian_8+$bai_8+$shi_8;
		$fenbu_95 = $qian_9+$bai_9+$shi_9;

		$this->assign('fenbu_05',$fenbu_05);
		$this->assign('fenbu_15',$fenbu_15);
		$this->assign('fenbu_25',$fenbu_25);
		$this->assign('fenbu_35',$fenbu_35);
		$this->assign('fenbu_45',$fenbu_45);
		$this->assign('fenbu_55',$fenbu_55);
		$this->assign('fenbu_65',$fenbu_65);
		$this->assign('fenbu_75',$fenbu_75);
		$this->assign('fenbu_85',$fenbu_85);
		$this->assign('fenbu_95',$fenbu_95);

		$fenbu_06 = $bai_0+$shi_0+$ge_0;
		$fenbu_16 = $bai_1+$shi_1+$ge_1;
		$fenbu_26 = $bai_2+$shi_2+$ge_2;
		$fenbu_36 = $bai_3+$shi_3+$ge_3;
		$fenbu_46 = $bai_4+$shi_4+$ge_4;
		$fenbu_56 = $bai_5+$shi_5+$ge_5;
		$fenbu_66 = $bai_6+$shi_6+$ge_6;
		$fenbu_76 = $bai_7+$shi_7+$ge_7;
		$fenbu_86 = $bai_8+$shi_8+$ge_8;
		$fenbu_96 = $bai_9+$shi_9+$ge_9;

		$fenbu_07 = $wan_0+$qian_0;
		$fenbu_17 = $wan_1+$qian_1;
		$fenbu_27 = $wan_2+$qian_2;
		$fenbu_37 = $wan_3+$qian_3;
		$fenbu_47 = $wan_4+$qian_4;
		$fenbu_57 = $wan_5+$qian_5;
		$fenbu_67 = $wan_6+$qian_6;
		$fenbu_77 = $wan_7+$qian_7;
		$fenbu_87 = $wan_8+$qian_8;
		$fenbu_97 = $wan_9+$qian_9;

		$this->assign('fenbu_07',$fenbu_07);
		$this->assign('fenbu_17',$fenbu_17);
		$this->assign('fenbu_27',$fenbu_27);
		$this->assign('fenbu_37',$fenbu_37);
		$this->assign('fenbu_47',$fenbu_47);
		$this->assign('fenbu_57',$fenbu_57);
		$this->assign('fenbu_67',$fenbu_67);
		$this->assign('fenbu_77',$fenbu_77);
		$this->assign('fenbu_87',$fenbu_87);
		$this->assign('fenbu_97',$fenbu_97);

		$fenbu_08 = $shi_0+$ge_0;
		$fenbu_18 = $shi_1+$ge_1;
		$fenbu_28 = $shi_2+$ge_2;
		$fenbu_38 = $shi_3+$ge_3;
		$fenbu_48 = $shi_4+$ge_4;
		$fenbu_58 = $shi_5+$ge_5;
		$fenbu_68 = $shi_6+$ge_6;
		$fenbu_78 = $shi_7+$ge_7;
		$fenbu_88 = $shi_8+$ge_8;
		$fenbu_98 = $shi_9+$ge_9;

		$this->assign('fenbu_08',$fenbu_08);
		$this->assign('fenbu_18',$fenbu_18);
		$this->assign('fenbu_28',$fenbu_28);
		$this->assign('fenbu_38',$fenbu_38);
		$this->assign('fenbu_48',$fenbu_48);
		$this->assign('fenbu_58',$fenbu_58);
		$this->assign('fenbu_68',$fenbu_68);
		$this->assign('fenbu_78',$fenbu_78);
		$this->assign('fenbu_88',$fenbu_88);
		$this->assign('fenbu_98',$fenbu_98);

		$this->assign('fenbu_06',$fenbu_06);
		$this->assign('fenbu_16',$fenbu_16);
		$this->assign('fenbu_26',$fenbu_26);
		$this->assign('fenbu_36',$fenbu_36);
		$this->assign('fenbu_46',$fenbu_46);
		$this->assign('fenbu_56',$fenbu_56);
		$this->assign('fenbu_66',$fenbu_66);
		$this->assign('fenbu_76',$fenbu_76);
		$this->assign('fenbu_86',$fenbu_86);
		$this->assign('fenbu_96',$fenbu_96);

		$this->assign('wan_9',$wan_9);
		$this->assign('wan_8',$wan_8);
		$this->assign('wan_7',$wan_7);
		$this->assign('wan_6',$wan_6);
		$this->assign('wan_5',$wan_5);
		$this->assign('wan_4',$wan_4);
		$this->assign('wan_3',$wan_3);
		$this->assign('wan_2',$wan_2);
		$this->assign('wan_1',$wan_1);
		$this->assign('wan_0',$wan_0);

		$this->assign('qian_0',$qian_0);
		$this->assign('qian_1',$qian_1);
		$this->assign('qian_2',$qian_2);
		$this->assign('qian_3',$qian_3);
		$this->assign('qian_4',$qian_4);
		$this->assign('qian_5',$qian_5);
		$this->assign('qian_6',$qian_6);
		$this->assign('qian_7',$qian_7);
		$this->assign('qian_8',$qian_8);
		$this->assign('qian_9',$qian_9);

		$this->assign('bai_0',$bai_0);
		$this->assign('bai_1',$bai_1);
		$this->assign('bai_2',$bai_2);
		$this->assign('bai_3',$bai_3);
		$this->assign('bai_4',$bai_4);
		$this->assign('bai_5',$bai_5);
		$this->assign('bai_6',$bai_6);
		$this->assign('bai_7',$bai_7);
		$this->assign('bai_8',$bai_8);
		$this->assign('bai_9',$bai_9);

		$this->assign('shi_0',$shi_0);
		$this->assign('shi_1',$shi_1);
		$this->assign('shi_2',$shi_2);
		$this->assign('shi_3',$shi_3);
		$this->assign('shi_4',$shi_4);
		$this->assign('shi_5',$shi_5);
		$this->assign('shi_6',$shi_6);
		$this->assign('shi_7',$shi_7);
		$this->assign('shi_8',$shi_8);
		$this->assign('shi_9',$shi_9);

		$this->assign('ge_0',$ge_0);
		$this->assign('ge_1',$ge_1);
		$this->assign('ge_2',$ge_2);
		$this->assign('ge_3',$ge_3);
		$this->assign('ge_4',$ge_4);
		$this->assign('ge_5',$ge_5);
		$this->assign('ge_6',$ge_6);
		$this->assign('ge_7',$ge_7);
		$this->assign('ge_8',$ge_8);
		$this->assign('ge_9',$ge_9);

		//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$w_0 = intval($zhanshi_qishu/$wan_0);
		$w_1 = intval($zhanshi_qishu/$wan_1);
		$w_2 = intval($zhanshi_qishu/$wan_2);
		$w_3 = intval($zhanshi_qishu/$wan_3);
		$w_4 = intval($zhanshi_qishu/$wan_4);
		$w_5 = intval($zhanshi_qishu/$wan_5);
		$w_6 = intval($zhanshi_qishu/$wan_6);
		$w_7 = intval($zhanshi_qishu/$wan_7);
		$w_8 = intval($zhanshi_qishu/$wan_8);
		$w_9 = intval($zhanshi_qishu/$wan_9);
		$this->assign('w_0',$w_0);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);

		$q_0 = intval($zhanshi_qishu/$qian_0);
		$q_1 = intval($zhanshi_qishu/$qian_1);
		$q_2 = intval($zhanshi_qishu/$qian_2);
		$q_3 = intval($zhanshi_qishu/$qian_3);
		$q_4 = intval($zhanshi_qishu/$qian_4);
		$q_5 = intval($zhanshi_qishu/$qian_5);
		$q_6 = intval($zhanshi_qishu/$qian_6);
		$q_7 = intval($zhanshi_qishu/$qian_7);
		$q_8 = intval($zhanshi_qishu/$qian_8);
		$q_9 = intval($zhanshi_qishu/$qian_9);
		$this->assign('q_0',$q_0);
		$this->assign('q_1',$q_1);
		$this->assign('q_2',$q_2);
		$this->assign('q_3',$q_3);
		$this->assign('q_4',$q_4);
		$this->assign('q_5',$q_5);
		$this->assign('q_6',$q_6);
		$this->assign('q_7',$q_7);
		$this->assign('q_8',$q_8);
		$this->assign('q_9',$q_9);

		$b_0 = intval($zhanshi_qishu/$bai_0);
		$b_1 = intval($zhanshi_qishu/$bai_1);
		$b_2 = intval($zhanshi_qishu/$bai_2);
		$b_3 = intval($zhanshi_qishu/$bai_3);
		$b_4 = intval($zhanshi_qishu/$bai_4);
		$b_5 = intval($zhanshi_qishu/$bai_5);
		$b_6 = intval($zhanshi_qishu/$bai_6);
		$b_7 = intval($zhanshi_qishu/$bai_7);
		$b_8 = intval($zhanshi_qishu/$bai_8);
		$b_9 = intval($zhanshi_qishu/$bai_9);
		$this->assign('b_0',$b_0);
		$this->assign('b_1',$b_1);
		$this->assign('b_2',$b_2);
		$this->assign('b_3',$b_3);
		$this->assign('b_4',$b_4);
		$this->assign('b_5',$b_5);
		$this->assign('b_6',$b_6);
		$this->assign('b_7',$b_7);
		$this->assign('b_8',$b_8);
		$this->assign('b_9',$b_9);

		$s_0 = intval($zhanshi_qishu/$shi_0);
		$s_1 = intval($zhanshi_qishu/$shi_1);
		$s_2 = intval($zhanshi_qishu/$shi_2);
		$s_3 = intval($zhanshi_qishu/$shi_3);
		$s_4 = intval($zhanshi_qishu/$shi_4);
		$s_5 = intval($zhanshi_qishu/$shi_5);
		$s_6 = intval($zhanshi_qishu/$shi_6);
		$s_7 = intval($zhanshi_qishu/$shi_7);
		$s_8 = intval($zhanshi_qishu/$shi_8);
		$s_9 = intval($zhanshi_qishu/$shi_9);
		$this->assign('s_0',$s_0);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);

		$g_0 = intval($zhanshi_qishu/$ge_0);
		$g_1 = intval($zhanshi_qishu/$ge_1);
		$g_2 = intval($zhanshi_qishu/$ge_2);
		$g_3 = intval($zhanshi_qishu/$ge_3);
		$g_4 = intval($zhanshi_qishu/$ge_4);
		$g_5 = intval($zhanshi_qishu/$ge_5);
		$g_6 = intval($zhanshi_qishu/$ge_6);
		$g_7 = intval($zhanshi_qishu/$ge_7);
		$g_8 = intval($zhanshi_qishu/$ge_8);
		$g_9 = intval($zhanshi_qishu/$ge_9);
		$this->assign('g_0',$g_0);
		$this->assign('g_1',$g_1);
		$this->assign('g_2',$g_2);
		$this->assign('g_3',$g_3);
		$this->assign('g_4',$g_4);
		$this->assign('g_5',$g_5);
		$this->assign('g_6',$g_6);
		$this->assign('g_7',$g_7);
		$this->assign('g_8',$g_8);
		$this->assign('g_9',$g_9);

		$fen_0 = intval($zhanshi_qishu/$fenbu_0);
		$fen_1 = intval($zhanshi_qishu/$fenbu_1);
		$fen_2 = intval($zhanshi_qishu/$fenbu_2);
		$fen_3 = intval($zhanshi_qishu/$fenbu_3);
		$fen_4 = intval($zhanshi_qishu/$fenbu_4);
		$fen_5 = intval($zhanshi_qishu/$fenbu_5);
		$fen_6 = intval($zhanshi_qishu/$fenbu_6);
		$fen_7 = intval($zhanshi_qishu/$fenbu_7);
		$fen_8 = intval($zhanshi_qishu/$fenbu_8);
		$fen_9 = intval($zhanshi_qishu/$fenbu_9);
		$this->assign('fen_0',$fen_0);
		$this->assign('fen_1',$fen_1);
		$this->assign('fen_2',$fen_2);
		$this->assign('fen_3',$fen_3);
		$this->assign('fen_4',$fen_4);
		$this->assign('fen_5',$fen_5);
		$this->assign('fen_6',$fen_6);
		$this->assign('fen_7',$fen_7);
		$this->assign('fen_8',$fen_8);
		$this->assign('fen_9',$fen_9);

		$fen_03 = intval($zhanshi_qishu/$fenbu_03);
		$fen_13 = intval($zhanshi_qishu/$fenbu_13);
		$fen_23 = intval($zhanshi_qishu/$fenbu_23);
		$fen_33 = intval($zhanshi_qishu/$fenbu_33);
		$fen_43 = intval($zhanshi_qishu/$fenbu_43);
		$fen_53 = intval($zhanshi_qishu/$fenbu_53);
		$fen_63 = intval($zhanshi_qishu/$fenbu_63);
		$fen_73 = intval($zhanshi_qishu/$fenbu_73);
		$fen_83 = intval($zhanshi_qishu/$fenbu_83);
		$fen_93 = intval($zhanshi_qishu/$fenbu_93);
		$this->assign('fen_03',$fen_03);
		$this->assign('fen_13',$fen_13);
		$this->assign('fen_23',$fen_23);
		$this->assign('fen_33',$fen_33);
		$this->assign('fen_43',$fen_43);
		$this->assign('fen_53',$fen_53);
		$this->assign('fen_63',$fen_63);
		$this->assign('fen_73',$fen_73);
		$this->assign('fen_83',$fen_83);
		$this->assign('fen_93',$fen_93);

		$fen_04 = intval($zhanshi_qishu/$fenbu_04);
		$fen_14 = intval($zhanshi_qishu/$fenbu_14);
		$fen_24 = intval($zhanshi_qishu/$fenbu_24);
		$fen_34 = intval($zhanshi_qishu/$fenbu_34);
		$fen_44 = intval($zhanshi_qishu/$fenbu_44);
		$fen_54 = intval($zhanshi_qishu/$fenbu_54);
		$fen_64 = intval($zhanshi_qishu/$fenbu_64);
		$fen_74 = intval($zhanshi_qishu/$fenbu_74);
		$fen_84 = intval($zhanshi_qishu/$fenbu_84);
		$fen_94 = intval($zhanshi_qishu/$fenbu_94);
		$this->assign('fen_04',$fen_04);
		$this->assign('fen_14',$fen_14);
		$this->assign('fen_24',$fen_24);
		$this->assign('fen_34',$fen_34);
		$this->assign('fen_44',$fen_44);
		$this->assign('fen_54',$fen_54);
		$this->assign('fen_64',$fen_64);
		$this->assign('fen_74',$fen_74);
		$this->assign('fen_84',$fen_84);
		$this->assign('fen_94',$fen_94);

		$fen_05 = intval($zhanshi_qishu/$fenbu_05);
		$fen_15 = intval($zhanshi_qishu/$fenbu_15);
		$fen_25 = intval($zhanshi_qishu/$fenbu_25);
		$fen_35 = intval($zhanshi_qishu/$fenbu_35);
		$fen_45 = intval($zhanshi_qishu/$fenbu_45);
		$fen_55 = intval($zhanshi_qishu/$fenbu_55);
		$fen_65 = intval($zhanshi_qishu/$fenbu_65);
		$fen_75 = intval($zhanshi_qishu/$fenbu_75);
		$fen_85 = intval($zhanshi_qishu/$fenbu_85);
		$fen_95 = intval($zhanshi_qishu/$fenbu_95);
		$this->assign('fen_05',$fen_05);
		$this->assign('fen_15',$fen_15);
		$this->assign('fen_25',$fen_25);
		$this->assign('fen_35',$fen_35);
		$this->assign('fen_45',$fen_45);
		$this->assign('fen_55',$fen_55);
		$this->assign('fen_65',$fen_65);
		$this->assign('fen_75',$fen_75);
		$this->assign('fen_85',$fen_85);
		$this->assign('fen_95',$fen_95);

		$fen_06 = intval($zhanshi_qishu/$fenbu_06);
		$fen_16 = intval($zhanshi_qishu/$fenbu_16);
		$fen_26 = intval($zhanshi_qishu/$fenbu_26);
		$fen_36 = intval($zhanshi_qishu/$fenbu_36);
		$fen_46 = intval($zhanshi_qishu/$fenbu_46);
		$fen_56 = intval($zhanshi_qishu/$fenbu_56);
		$fen_66 = intval($zhanshi_qishu/$fenbu_66);
		$fen_76 = intval($zhanshi_qishu/$fenbu_76);
		$fen_86 = intval($zhanshi_qishu/$fenbu_86);
		$fen_96 = intval($zhanshi_qishu/$fenbu_96);
		$this->assign('fen_06',$fen_06);
		$this->assign('fen_16',$fen_16);
		$this->assign('fen_26',$fen_26);
		$this->assign('fen_36',$fen_36);
		$this->assign('fen_46',$fen_46);
		$this->assign('fen_56',$fen_56);
		$this->assign('fen_66',$fen_66);
		$this->assign('fen_76',$fen_76);
		$this->assign('fen_86',$fen_86);
		$this->assign('fen_96',$fen_96);

		$fen_07 = intval($zhanshi_qishu/$fenbu_07);
		$fen_17 = intval($zhanshi_qishu/$fenbu_17);
		$fen_27 = intval($zhanshi_qishu/$fenbu_27);
		$fen_37 = intval($zhanshi_qishu/$fenbu_37);
		$fen_47 = intval($zhanshi_qishu/$fenbu_47);
		$fen_57 = intval($zhanshi_qishu/$fenbu_57);
		$fen_67 = intval($zhanshi_qishu/$fenbu_67);
		$fen_77 = intval($zhanshi_qishu/$fenbu_77);
		$fen_87 = intval($zhanshi_qishu/$fenbu_87);
		$fen_97= intval($zhanshi_qishu/$fenbu_97);
		$this->assign('fen_07',$fen_07);
		$this->assign('fen_17',$fen_17);
		$this->assign('fen_27',$fen_27);
		$this->assign('fen_37',$fen_37);
		$this->assign('fen_47',$fen_47);
		$this->assign('fen_57',$fen_57);
		$this->assign('fen_67',$fen_67);
		$this->assign('fen_77',$fen_77);
		$this->assign('fen_87',$fen_87);
		$this->assign('fen_97',$fen_97);

		$fen_08 = intval($zhanshi_qishu/$fenbu_08);
		$fen_18 = intval($zhanshi_qishu/$fenbu_18);
		$fen_28 = intval($zhanshi_qishu/$fenbu_28);
		$fen_38 = intval($zhanshi_qishu/$fenbu_38);
		$fen_48 = intval($zhanshi_qishu/$fenbu_48);
		$fen_58 = intval($zhanshi_qishu/$fenbu_58);
		$fen_68 = intval($zhanshi_qishu/$fenbu_68);
		$fen_78 = intval($zhanshi_qishu/$fenbu_78);
		$fen_88 = intval($zhanshi_qishu/$fenbu_88);
		$fen_98 = intval($zhanshi_qishu/$fenbu_98);
		$this->assign('fen_08',$fen_08);
		$this->assign('fen_18',$fen_18);
		$this->assign('fen_28',$fen_28);
		$this->assign('fen_38',$fen_38);
		$this->assign('fen_48',$fen_48);
		$this->assign('fen_58',$fen_58);
		$this->assign('fen_68',$fen_68);
		$this->assign('fen_78',$fen_78);
		$this->assign('fen_88',$fen_88);
		$this->assign('fen_98',$fen_98);

		$ku_0 = intval($zhanshi_qishu/$kua_0);
		$ku_1 = intval($zhanshi_qishu/$kua_1);
		$ku_2 = intval($zhanshi_qishu/$kua_2);
		$ku_3 = intval($zhanshi_qishu/$kua_3);
		$ku_4 = intval($zhanshi_qishu/$kua_4);
		$ku_5 = intval($zhanshi_qishu/$kua_5);
		$ku_6 = intval($zhanshi_qishu/$kua_6);
		$ku_7 = intval($zhanshi_qishu/$kua_7);
		$ku_8 = intval($zhanshi_qishu/$kua_8);
		$ku_9 = intval($zhanshi_qishu/$kua_9);
		$this->assign('ku_0',$ku_0);
		$this->assign('ku_1',$ku_1);
		$this->assign('ku_2',$ku_2);
		$this->assign('ku_3',$ku_3);
		$this->assign('ku_4',$ku_4);
		$this->assign('ku_5',$ku_5);
		$this->assign('ku_6',$ku_6);
		$this->assign('ku_7',$ku_7);
		$this->assign('ku_8',$ku_8);
		$this->assign('ku_9',$ku_9);

		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);

		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

		$this->assign('qishu',$qishu);
		$this->assign('maifa',$maifa);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function xjssc_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='xjssc'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='xjssc'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='xjssc'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();

		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "新疆时时彩报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}

	//天津时时彩走势图列表
	public function trendChart_tjssc(){
		$qishu = I("qishu");
		$maifa = I("maifa");
		if($maifa==""){
			$maifa=1;
		}
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='tjssc'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='tjssc'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='tjssc'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$w[] = $v[0];
			$q[] = $v[2];
			$b[] = $v[4];
			$s[] = $v[6];
			$g[] = $v[8];
		}

		foreach($aa as $v){
			$ass[]= explode(',',$v);
		}

		foreach($ass as $v){
			$arrs[] = max($v)-min($v);

		}
		$qq = implode(',',$arrs);
		$this->assign("qq",$qq);

		//号码跨度
		$kua_0 = substr_count($qq,'0');
		$kua_1 = substr_count($qq,'1');
		$kua_2 = substr_count($qq,'2');
		$kua_3 = substr_count($qq,'3');
		$kua_4 = substr_count($qq,'4');
		$kua_5 = substr_count($qq,'5');
		$kua_6 = substr_count($qq,'6');
		$kua_7 = substr_count($qq,'7');
		$kua_8 = substr_count($qq,'8');
		$kua_9 = substr_count($qq,'9');


		$wan_0 = substr_count(implode(',',$w),'0');
		$wan_1 = substr_count(implode(',',$w),'1');
		$wan_2 = substr_count(implode(',',$w),'2');
		$wan_3 = substr_count(implode(',',$w),'3');
		$wan_4 = substr_count(implode(',',$w),'4');
		$wan_5 = substr_count(implode(',',$w),'5');
		$wan_6 = substr_count(implode(',',$w),'6');
		$wan_7 = substr_count(implode(',',$w),'7');
		$wan_8 = substr_count(implode(',',$w),'8');
		$wan_9 = substr_count(implode(',',$w),'9');

		$qian_0 = substr_count(implode(',',$q),'0');
		$qian_1 = substr_count(implode(',',$q),'1');
		$qian_2 = substr_count(implode(',',$q),'2');
		$qian_3 = substr_count(implode(',',$q),'3');
		$qian_4 = substr_count(implode(',',$q),'4');
		$qian_5 = substr_count(implode(',',$q),'5');
		$qian_6 = substr_count(implode(',',$q),'6');
		$qian_7 = substr_count(implode(',',$q),'7');
		$qian_8 = substr_count(implode(',',$q),'8');
		$qian_9 = substr_count(implode(',',$q),'9');

		$bai_0 = substr_count(implode(',',$b),'0');
		$bai_1 = substr_count(implode(',',$b),'1');
		$bai_2 = substr_count(implode(',',$b),'2');
		$bai_3 = substr_count(implode(',',$b),'3');
		$bai_4 = substr_count(implode(',',$b),'4');
		$bai_5 = substr_count(implode(',',$b),'5');
		$bai_6 = substr_count(implode(',',$b),'6');
		$bai_7 = substr_count(implode(',',$b),'7');
		$bai_8 = substr_count(implode(',',$b),'8');
		$bai_9 = substr_count(implode(',',$b),'9');

		$shi_0 = substr_count(implode(',',$s),'0');
		$shi_1 = substr_count(implode(',',$s),'1');
		$shi_2 = substr_count(implode(',',$s),'2');
		$shi_3 = substr_count(implode(',',$s),'3');
		$shi_4 = substr_count(implode(',',$s),'4');
		$shi_5 = substr_count(implode(',',$s),'5');
		$shi_6 = substr_count(implode(',',$s),'6');
		$shi_7 = substr_count(implode(',',$s),'7');
		$shi_8 = substr_count(implode(',',$s),'8');
		$shi_9 = substr_count(implode(',',$s),'9');

		$ge_0 = substr_count(implode(',',$g),'0');
		$ge_1 = substr_count(implode(',',$g),'1');
		$ge_2 = substr_count(implode(',',$g),'2');
		$ge_3 = substr_count(implode(',',$g),'3');
		$ge_4 = substr_count(implode(',',$g),'4');
		$ge_5 = substr_count(implode(',',$g),'5');
		$ge_6 = substr_count(implode(',',$g),'6');
		$ge_7 = substr_count(implode(',',$g),'7');
		$ge_8 = substr_count(implode(',',$g),'8');
		$ge_9 = substr_count(implode(',',$g),'9');

		$fenbu_0 = $wan_0+$qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_1 = $wan_1+$qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_2 = $wan_2+$qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_3 = $wan_3+$qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_4 = $wan_4+$qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_5 = $wan_5+$qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_6 = $wan_6+$qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_7 = $wan_7+$qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_8 = $wan_8+$qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_9 = $wan_9+$qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_0',$fenbu_0);
		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);

		$fenbu_03 = $qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_13 = $qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_23 = $qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_33 = $qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_43 = $qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_53 = $qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_63 = $qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_73 = $qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_83 = $qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_93 = $qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_03',$fenbu_03);
		$this->assign('fenbu_13',$fenbu_13);
		$this->assign('fenbu_23',$fenbu_23);
		$this->assign('fenbu_33',$fenbu_33);
		$this->assign('fenbu_43',$fenbu_43);
		$this->assign('fenbu_53',$fenbu_53);
		$this->assign('fenbu_63',$fenbu_63);
		$this->assign('fenbu_73',$fenbu_73);
		$this->assign('fenbu_83',$fenbu_83);
		$this->assign('fenbu_93',$fenbu_93);

		$fenbu_04 = $wan_0+$qian_0+$bai_0;
		$fenbu_14 = $wan_1+$qian_1+$bai_1;
		$fenbu_24 = $wan_2+$qian_2+$bai_2;
		$fenbu_34 = $wan_3+$qian_3+$bai_3;
		$fenbu_44 = $wan_4+$qian_4+$bai_4;
		$fenbu_54 = $wan_5+$qian_5+$bai_5;
		$fenbu_64 = $wan_6+$qian_6+$bai_6;
		$fenbu_74 = $wan_7+$qian_7+$bai_7;
		$fenbu_84 = $wan_8+$qian_8+$bai_8;
		$fenbu_94 = $wan_9+$qian_9+$bai_9;

		$this->assign('fenbu_04',$fenbu_04);
		$this->assign('fenbu_14',$fenbu_14);
		$this->assign('fenbu_24',$fenbu_24);
		$this->assign('fenbu_34',$fenbu_34);
		$this->assign('fenbu_44',$fenbu_44);
		$this->assign('fenbu_54',$fenbu_54);
		$this->assign('fenbu_64',$fenbu_64);
		$this->assign('fenbu_74',$fenbu_74);
		$this->assign('fenbu_84',$fenbu_84);
		$this->assign('fenbu_94',$fenbu_94);

		$fenbu_05 = $qian_0+$bai_0+$shi_0;
		$fenbu_15 = $qian_1+$bai_1+$shi_1;
		$fenbu_25 = $qian_2+$bai_2+$shi_2;
		$fenbu_35 = $qian_3+$bai_3+$shi_3;
		$fenbu_45 = $qian_4+$bai_4+$shi_4;
		$fenbu_55 = $qian_5+$bai_5+$shi_5;
		$fenbu_65 = $qian_6+$bai_6+$shi_6;
		$fenbu_75 = $qian_7+$bai_7+$shi_7;
		$fenbu_85 = $qian_8+$bai_8+$shi_8;
		$fenbu_95 = $qian_9+$bai_9+$shi_9;

		$this->assign('fenbu_05',$fenbu_05);
		$this->assign('fenbu_15',$fenbu_15);
		$this->assign('fenbu_25',$fenbu_25);
		$this->assign('fenbu_35',$fenbu_35);
		$this->assign('fenbu_45',$fenbu_45);
		$this->assign('fenbu_55',$fenbu_55);
		$this->assign('fenbu_65',$fenbu_65);
		$this->assign('fenbu_75',$fenbu_75);
		$this->assign('fenbu_85',$fenbu_85);
		$this->assign('fenbu_95',$fenbu_95);

		$fenbu_06 = $bai_0+$shi_0+$ge_0;
		$fenbu_16 = $bai_1+$shi_1+$ge_1;
		$fenbu_26 = $bai_2+$shi_2+$ge_2;
		$fenbu_36 = $bai_3+$shi_3+$ge_3;
		$fenbu_46 = $bai_4+$shi_4+$ge_4;
		$fenbu_56 = $bai_5+$shi_5+$ge_5;
		$fenbu_66 = $bai_6+$shi_6+$ge_6;
		$fenbu_76 = $bai_7+$shi_7+$ge_7;
		$fenbu_86 = $bai_8+$shi_8+$ge_8;
		$fenbu_96 = $bai_9+$shi_9+$ge_9;

		$fenbu_07 = $wan_0+$qian_0;
		$fenbu_17 = $wan_1+$qian_1;
		$fenbu_27 = $wan_2+$qian_2;
		$fenbu_37 = $wan_3+$qian_3;
		$fenbu_47 = $wan_4+$qian_4;
		$fenbu_57 = $wan_5+$qian_5;
		$fenbu_67 = $wan_6+$qian_6;
		$fenbu_77 = $wan_7+$qian_7;
		$fenbu_87 = $wan_8+$qian_8;
		$fenbu_97 = $wan_9+$qian_9;

		$this->assign('fenbu_07',$fenbu_07);
		$this->assign('fenbu_17',$fenbu_17);
		$this->assign('fenbu_27',$fenbu_27);
		$this->assign('fenbu_37',$fenbu_37);
		$this->assign('fenbu_47',$fenbu_47);
		$this->assign('fenbu_57',$fenbu_57);
		$this->assign('fenbu_67',$fenbu_67);
		$this->assign('fenbu_77',$fenbu_77);
		$this->assign('fenbu_87',$fenbu_87);
		$this->assign('fenbu_97',$fenbu_97);

		$fenbu_08 = $shi_0+$ge_0;
		$fenbu_18 = $shi_1+$ge_1;
		$fenbu_28 = $shi_2+$ge_2;
		$fenbu_38 = $shi_3+$ge_3;
		$fenbu_48 = $shi_4+$ge_4;
		$fenbu_58 = $shi_5+$ge_5;
		$fenbu_68 = $shi_6+$ge_6;
		$fenbu_78 = $shi_7+$ge_7;
		$fenbu_88 = $shi_8+$ge_8;
		$fenbu_98 = $shi_9+$ge_9;

		$this->assign('fenbu_08',$fenbu_08);
		$this->assign('fenbu_18',$fenbu_18);
		$this->assign('fenbu_28',$fenbu_28);
		$this->assign('fenbu_38',$fenbu_38);
		$this->assign('fenbu_48',$fenbu_48);
		$this->assign('fenbu_58',$fenbu_58);
		$this->assign('fenbu_68',$fenbu_68);
		$this->assign('fenbu_78',$fenbu_78);
		$this->assign('fenbu_88',$fenbu_88);
		$this->assign('fenbu_98',$fenbu_98);

		$this->assign('fenbu_06',$fenbu_06);
		$this->assign('fenbu_16',$fenbu_16);
		$this->assign('fenbu_26',$fenbu_26);
		$this->assign('fenbu_36',$fenbu_36);
		$this->assign('fenbu_46',$fenbu_46);
		$this->assign('fenbu_56',$fenbu_56);
		$this->assign('fenbu_66',$fenbu_66);
		$this->assign('fenbu_76',$fenbu_76);
		$this->assign('fenbu_86',$fenbu_86);
		$this->assign('fenbu_96',$fenbu_96);

		$this->assign('wan_9',$wan_9);
		$this->assign('wan_8',$wan_8);
		$this->assign('wan_7',$wan_7);
		$this->assign('wan_6',$wan_6);
		$this->assign('wan_5',$wan_5);
		$this->assign('wan_4',$wan_4);
		$this->assign('wan_3',$wan_3);
		$this->assign('wan_2',$wan_2);
		$this->assign('wan_1',$wan_1);
		$this->assign('wan_0',$wan_0);

		$this->assign('qian_0',$qian_0);
		$this->assign('qian_1',$qian_1);
		$this->assign('qian_2',$qian_2);
		$this->assign('qian_3',$qian_3);
		$this->assign('qian_4',$qian_4);
		$this->assign('qian_5',$qian_5);
		$this->assign('qian_6',$qian_6);
		$this->assign('qian_7',$qian_7);
		$this->assign('qian_8',$qian_8);
		$this->assign('qian_9',$qian_9);

		$this->assign('bai_0',$bai_0);
		$this->assign('bai_1',$bai_1);
		$this->assign('bai_2',$bai_2);
		$this->assign('bai_3',$bai_3);
		$this->assign('bai_4',$bai_4);
		$this->assign('bai_5',$bai_5);
		$this->assign('bai_6',$bai_6);
		$this->assign('bai_7',$bai_7);
		$this->assign('bai_8',$bai_8);
		$this->assign('bai_9',$bai_9);

		$this->assign('shi_0',$shi_0);
		$this->assign('shi_1',$shi_1);
		$this->assign('shi_2',$shi_2);
		$this->assign('shi_3',$shi_3);
		$this->assign('shi_4',$shi_4);
		$this->assign('shi_5',$shi_5);
		$this->assign('shi_6',$shi_6);
		$this->assign('shi_7',$shi_7);
		$this->assign('shi_8',$shi_8);
		$this->assign('shi_9',$shi_9);

		$this->assign('ge_0',$ge_0);
		$this->assign('ge_1',$ge_1);
		$this->assign('ge_2',$ge_2);
		$this->assign('ge_3',$ge_3);
		$this->assign('ge_4',$ge_4);
		$this->assign('ge_5',$ge_5);
		$this->assign('ge_6',$ge_6);
		$this->assign('ge_7',$ge_7);
		$this->assign('ge_8',$ge_8);
		$this->assign('ge_9',$ge_9);

		//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$w_0 = intval($zhanshi_qishu/$wan_0);
		$w_1 = intval($zhanshi_qishu/$wan_1);
		$w_2 = intval($zhanshi_qishu/$wan_2);
		$w_3 = intval($zhanshi_qishu/$wan_3);
		$w_4 = intval($zhanshi_qishu/$wan_4);
		$w_5 = intval($zhanshi_qishu/$wan_5);
		$w_6 = intval($zhanshi_qishu/$wan_6);
		$w_7 = intval($zhanshi_qishu/$wan_7);
		$w_8 = intval($zhanshi_qishu/$wan_8);
		$w_9 = intval($zhanshi_qishu/$wan_9);
		$this->assign('w_0',$w_0);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);

		$q_0 = intval($zhanshi_qishu/$qian_0);
		$q_1 = intval($zhanshi_qishu/$qian_1);
		$q_2 = intval($zhanshi_qishu/$qian_2);
		$q_3 = intval($zhanshi_qishu/$qian_3);
		$q_4 = intval($zhanshi_qishu/$qian_4);
		$q_5 = intval($zhanshi_qishu/$qian_5);
		$q_6 = intval($zhanshi_qishu/$qian_6);
		$q_7 = intval($zhanshi_qishu/$qian_7);
		$q_8 = intval($zhanshi_qishu/$qian_8);
		$q_9 = intval($zhanshi_qishu/$qian_9);
		$this->assign('q_0',$q_0);
		$this->assign('q_1',$q_1);
		$this->assign('q_2',$q_2);
		$this->assign('q_3',$q_3);
		$this->assign('q_4',$q_4);
		$this->assign('q_5',$q_5);
		$this->assign('q_6',$q_6);
		$this->assign('q_7',$q_7);
		$this->assign('q_8',$q_8);
		$this->assign('q_9',$q_9);

		$b_0 = intval($zhanshi_qishu/$bai_0);
		$b_1 = intval($zhanshi_qishu/$bai_1);
		$b_2 = intval($zhanshi_qishu/$bai_2);
		$b_3 = intval($zhanshi_qishu/$bai_3);
		$b_4 = intval($zhanshi_qishu/$bai_4);
		$b_5 = intval($zhanshi_qishu/$bai_5);
		$b_6 = intval($zhanshi_qishu/$bai_6);
		$b_7 = intval($zhanshi_qishu/$bai_7);
		$b_8 = intval($zhanshi_qishu/$bai_8);
		$b_9 = intval($zhanshi_qishu/$bai_9);
		$this->assign('b_0',$b_0);
		$this->assign('b_1',$b_1);
		$this->assign('b_2',$b_2);
		$this->assign('b_3',$b_3);
		$this->assign('b_4',$b_4);
		$this->assign('b_5',$b_5);
		$this->assign('b_6',$b_6);
		$this->assign('b_7',$b_7);
		$this->assign('b_8',$b_8);
		$this->assign('b_9',$b_9);

		$s_0 = intval($zhanshi_qishu/$shi_0);
		$s_1 = intval($zhanshi_qishu/$shi_1);
		$s_2 = intval($zhanshi_qishu/$shi_2);
		$s_3 = intval($zhanshi_qishu/$shi_3);
		$s_4 = intval($zhanshi_qishu/$shi_4);
		$s_5 = intval($zhanshi_qishu/$shi_5);
		$s_6 = intval($zhanshi_qishu/$shi_6);
		$s_7 = intval($zhanshi_qishu/$shi_7);
		$s_8 = intval($zhanshi_qishu/$shi_8);
		$s_9 = intval($zhanshi_qishu/$shi_9);
		$this->assign('s_0',$s_0);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);

		$g_0 = intval($zhanshi_qishu/$ge_0);
		$g_1 = intval($zhanshi_qishu/$ge_1);
		$g_2 = intval($zhanshi_qishu/$ge_2);
		$g_3 = intval($zhanshi_qishu/$ge_3);
		$g_4 = intval($zhanshi_qishu/$ge_4);
		$g_5 = intval($zhanshi_qishu/$ge_5);
		$g_6 = intval($zhanshi_qishu/$ge_6);
		$g_7 = intval($zhanshi_qishu/$ge_7);
		$g_8 = intval($zhanshi_qishu/$ge_8);
		$g_9 = intval($zhanshi_qishu/$ge_9);
		$this->assign('g_0',$g_0);
		$this->assign('g_1',$g_1);
		$this->assign('g_2',$g_2);
		$this->assign('g_3',$g_3);
		$this->assign('g_4',$g_4);
		$this->assign('g_5',$g_5);
		$this->assign('g_6',$g_6);
		$this->assign('g_7',$g_7);
		$this->assign('g_8',$g_8);
		$this->assign('g_9',$g_9);

		$fen_0 = intval($zhanshi_qishu/$fenbu_0);
		$fen_1 = intval($zhanshi_qishu/$fenbu_1);
		$fen_2 = intval($zhanshi_qishu/$fenbu_2);
		$fen_3 = intval($zhanshi_qishu/$fenbu_3);
		$fen_4 = intval($zhanshi_qishu/$fenbu_4);
		$fen_5 = intval($zhanshi_qishu/$fenbu_5);
		$fen_6 = intval($zhanshi_qishu/$fenbu_6);
		$fen_7 = intval($zhanshi_qishu/$fenbu_7);
		$fen_8 = intval($zhanshi_qishu/$fenbu_8);
		$fen_9 = intval($zhanshi_qishu/$fenbu_9);
		$this->assign('fen_0',$fen_0);
		$this->assign('fen_1',$fen_1);
		$this->assign('fen_2',$fen_2);
		$this->assign('fen_3',$fen_3);
		$this->assign('fen_4',$fen_4);
		$this->assign('fen_5',$fen_5);
		$this->assign('fen_6',$fen_6);
		$this->assign('fen_7',$fen_7);
		$this->assign('fen_8',$fen_8);
		$this->assign('fen_9',$fen_9);

		$fen_03 = intval($zhanshi_qishu/$fenbu_03);
		$fen_13 = intval($zhanshi_qishu/$fenbu_13);
		$fen_23 = intval($zhanshi_qishu/$fenbu_23);
		$fen_33 = intval($zhanshi_qishu/$fenbu_33);
		$fen_43 = intval($zhanshi_qishu/$fenbu_43);
		$fen_53 = intval($zhanshi_qishu/$fenbu_53);
		$fen_63 = intval($zhanshi_qishu/$fenbu_63);
		$fen_73 = intval($zhanshi_qishu/$fenbu_73);
		$fen_83 = intval($zhanshi_qishu/$fenbu_83);
		$fen_93 = intval($zhanshi_qishu/$fenbu_93);
		$this->assign('fen_03',$fen_03);
		$this->assign('fen_13',$fen_13);
		$this->assign('fen_23',$fen_23);
		$this->assign('fen_33',$fen_33);
		$this->assign('fen_43',$fen_43);
		$this->assign('fen_53',$fen_53);
		$this->assign('fen_63',$fen_63);
		$this->assign('fen_73',$fen_73);
		$this->assign('fen_83',$fen_83);
		$this->assign('fen_93',$fen_93);

		$fen_04 = intval($zhanshi_qishu/$fenbu_04);
		$fen_14 = intval($zhanshi_qishu/$fenbu_14);
		$fen_24 = intval($zhanshi_qishu/$fenbu_24);
		$fen_34 = intval($zhanshi_qishu/$fenbu_34);
		$fen_44 = intval($zhanshi_qishu/$fenbu_44);
		$fen_54 = intval($zhanshi_qishu/$fenbu_54);
		$fen_64 = intval($zhanshi_qishu/$fenbu_64);
		$fen_74 = intval($zhanshi_qishu/$fenbu_74);
		$fen_84 = intval($zhanshi_qishu/$fenbu_84);
		$fen_94 = intval($zhanshi_qishu/$fenbu_94);
		$this->assign('fen_04',$fen_04);
		$this->assign('fen_14',$fen_14);
		$this->assign('fen_24',$fen_24);
		$this->assign('fen_34',$fen_34);
		$this->assign('fen_44',$fen_44);
		$this->assign('fen_54',$fen_54);
		$this->assign('fen_64',$fen_64);
		$this->assign('fen_74',$fen_74);
		$this->assign('fen_84',$fen_84);
		$this->assign('fen_94',$fen_94);

		$fen_05 = intval($zhanshi_qishu/$fenbu_05);
		$fen_15 = intval($zhanshi_qishu/$fenbu_15);
		$fen_25 = intval($zhanshi_qishu/$fenbu_25);
		$fen_35 = intval($zhanshi_qishu/$fenbu_35);
		$fen_45 = intval($zhanshi_qishu/$fenbu_45);
		$fen_55 = intval($zhanshi_qishu/$fenbu_55);
		$fen_65 = intval($zhanshi_qishu/$fenbu_65);
		$fen_75 = intval($zhanshi_qishu/$fenbu_75);
		$fen_85 = intval($zhanshi_qishu/$fenbu_85);
		$fen_95 = intval($zhanshi_qishu/$fenbu_95);
		$this->assign('fen_05',$fen_05);
		$this->assign('fen_15',$fen_15);
		$this->assign('fen_25',$fen_25);
		$this->assign('fen_35',$fen_35);
		$this->assign('fen_45',$fen_45);
		$this->assign('fen_55',$fen_55);
		$this->assign('fen_65',$fen_65);
		$this->assign('fen_75',$fen_75);
		$this->assign('fen_85',$fen_85);
		$this->assign('fen_95',$fen_95);

		$fen_06 = intval($zhanshi_qishu/$fenbu_06);
		$fen_16 = intval($zhanshi_qishu/$fenbu_16);
		$fen_26 = intval($zhanshi_qishu/$fenbu_26);
		$fen_36 = intval($zhanshi_qishu/$fenbu_36);
		$fen_46 = intval($zhanshi_qishu/$fenbu_46);
		$fen_56 = intval($zhanshi_qishu/$fenbu_56);
		$fen_66 = intval($zhanshi_qishu/$fenbu_66);
		$fen_76 = intval($zhanshi_qishu/$fenbu_76);
		$fen_86 = intval($zhanshi_qishu/$fenbu_86);
		$fen_96 = intval($zhanshi_qishu/$fenbu_96);
		$this->assign('fen_06',$fen_06);
		$this->assign('fen_16',$fen_16);
		$this->assign('fen_26',$fen_26);
		$this->assign('fen_36',$fen_36);
		$this->assign('fen_46',$fen_46);
		$this->assign('fen_56',$fen_56);
		$this->assign('fen_66',$fen_66);
		$this->assign('fen_76',$fen_76);
		$this->assign('fen_86',$fen_86);
		$this->assign('fen_96',$fen_96);

		$fen_07 = intval($zhanshi_qishu/$fenbu_07);
		$fen_17 = intval($zhanshi_qishu/$fenbu_17);
		$fen_27 = intval($zhanshi_qishu/$fenbu_27);
		$fen_37 = intval($zhanshi_qishu/$fenbu_37);
		$fen_47 = intval($zhanshi_qishu/$fenbu_47);
		$fen_57 = intval($zhanshi_qishu/$fenbu_57);
		$fen_67 = intval($zhanshi_qishu/$fenbu_67);
		$fen_77 = intval($zhanshi_qishu/$fenbu_77);
		$fen_87 = intval($zhanshi_qishu/$fenbu_87);
		$fen_97= intval($zhanshi_qishu/$fenbu_97);
		$this->assign('fen_07',$fen_07);
		$this->assign('fen_17',$fen_17);
		$this->assign('fen_27',$fen_27);
		$this->assign('fen_37',$fen_37);
		$this->assign('fen_47',$fen_47);
		$this->assign('fen_57',$fen_57);
		$this->assign('fen_67',$fen_67);
		$this->assign('fen_77',$fen_77);
		$this->assign('fen_87',$fen_87);
		$this->assign('fen_97',$fen_97);

		$fen_08 = intval($zhanshi_qishu/$fenbu_08);
		$fen_18 = intval($zhanshi_qishu/$fenbu_18);
		$fen_28 = intval($zhanshi_qishu/$fenbu_28);
		$fen_38 = intval($zhanshi_qishu/$fenbu_38);
		$fen_48 = intval($zhanshi_qishu/$fenbu_48);
		$fen_58 = intval($zhanshi_qishu/$fenbu_58);
		$fen_68 = intval($zhanshi_qishu/$fenbu_68);
		$fen_78 = intval($zhanshi_qishu/$fenbu_78);
		$fen_88 = intval($zhanshi_qishu/$fenbu_88);
		$fen_98 = intval($zhanshi_qishu/$fenbu_98);
		$this->assign('fen_08',$fen_08);
		$this->assign('fen_18',$fen_18);
		$this->assign('fen_28',$fen_28);
		$this->assign('fen_38',$fen_38);
		$this->assign('fen_48',$fen_48);
		$this->assign('fen_58',$fen_58);
		$this->assign('fen_68',$fen_68);
		$this->assign('fen_78',$fen_78);
		$this->assign('fen_88',$fen_88);
		$this->assign('fen_98',$fen_98);

		$ku_0 = intval($zhanshi_qishu/$kua_0);
		$ku_1 = intval($zhanshi_qishu/$kua_1);
		$ku_2 = intval($zhanshi_qishu/$kua_2);
		$ku_3 = intval($zhanshi_qishu/$kua_3);
		$ku_4 = intval($zhanshi_qishu/$kua_4);
		$ku_5 = intval($zhanshi_qishu/$kua_5);
		$ku_6 = intval($zhanshi_qishu/$kua_6);
		$ku_7 = intval($zhanshi_qishu/$kua_7);
		$ku_8 = intval($zhanshi_qishu/$kua_8);
		$ku_9 = intval($zhanshi_qishu/$kua_9);
		$this->assign('ku_0',$ku_0);
		$this->assign('ku_1',$ku_1);
		$this->assign('ku_2',$ku_2);
		$this->assign('ku_3',$ku_3);
		$this->assign('ku_4',$ku_4);
		$this->assign('ku_5',$ku_5);
		$this->assign('ku_6',$ku_6);
		$this->assign('ku_7',$ku_7);
		$this->assign('ku_8',$ku_8);
		$this->assign('ku_9',$ku_9);

		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);

		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

		$this->assign('qishu',$qishu);
		$this->assign('maifa',$maifa);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function tjssc_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='tjssc'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='tjssc'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='tjssc'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();

		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "天津时彩报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}

	//埃及时时彩走势图列表
	public function trendChart_ajssc(){
		$qishu = I("qishu");
		$maifa = I("maifa");
		if($maifa==""){
			$maifa=1;
		}
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='ffc2'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='ffc2'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='ffc2'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$w[] = $v[0];
			$q[] = $v[2];
			$b[] = $v[4];
			$s[] = $v[6];
			$g[] = $v[8];
		}

		foreach($aa as $v){
			$ass[]= explode(',',$v);
		}

		foreach($ass as $v){
			$arrs[] = max($v)-min($v);

		}
		$qq = implode(',',$arrs);
		$this->assign("qq",$qq);

		//号码跨度
		$kua_0 = substr_count($qq,'0');
		$kua_1 = substr_count($qq,'1');
		$kua_2 = substr_count($qq,'2');
		$kua_3 = substr_count($qq,'3');
		$kua_4 = substr_count($qq,'4');
		$kua_5 = substr_count($qq,'5');
		$kua_6 = substr_count($qq,'6');
		$kua_7 = substr_count($qq,'7');
		$kua_8 = substr_count($qq,'8');
		$kua_9 = substr_count($qq,'9');


		$wan_0 = substr_count(implode(',',$w),'0');
		$wan_1 = substr_count(implode(',',$w),'1');
		$wan_2 = substr_count(implode(',',$w),'2');
		$wan_3 = substr_count(implode(',',$w),'3');
		$wan_4 = substr_count(implode(',',$w),'4');
		$wan_5 = substr_count(implode(',',$w),'5');
		$wan_6 = substr_count(implode(',',$w),'6');
		$wan_7 = substr_count(implode(',',$w),'7');
		$wan_8 = substr_count(implode(',',$w),'8');
		$wan_9 = substr_count(implode(',',$w),'9');

		$qian_0 = substr_count(implode(',',$q),'0');
		$qian_1 = substr_count(implode(',',$q),'1');
		$qian_2 = substr_count(implode(',',$q),'2');
		$qian_3 = substr_count(implode(',',$q),'3');
		$qian_4 = substr_count(implode(',',$q),'4');
		$qian_5 = substr_count(implode(',',$q),'5');
		$qian_6 = substr_count(implode(',',$q),'6');
		$qian_7 = substr_count(implode(',',$q),'7');
		$qian_8 = substr_count(implode(',',$q),'8');
		$qian_9 = substr_count(implode(',',$q),'9');

		$bai_0 = substr_count(implode(',',$b),'0');
		$bai_1 = substr_count(implode(',',$b),'1');
		$bai_2 = substr_count(implode(',',$b),'2');
		$bai_3 = substr_count(implode(',',$b),'3');
		$bai_4 = substr_count(implode(',',$b),'4');
		$bai_5 = substr_count(implode(',',$b),'5');
		$bai_6 = substr_count(implode(',',$b),'6');
		$bai_7 = substr_count(implode(',',$b),'7');
		$bai_8 = substr_count(implode(',',$b),'8');
		$bai_9 = substr_count(implode(',',$b),'9');

		$shi_0 = substr_count(implode(',',$s),'0');
		$shi_1 = substr_count(implode(',',$s),'1');
		$shi_2 = substr_count(implode(',',$s),'2');
		$shi_3 = substr_count(implode(',',$s),'3');
		$shi_4 = substr_count(implode(',',$s),'4');
		$shi_5 = substr_count(implode(',',$s),'5');
		$shi_6 = substr_count(implode(',',$s),'6');
		$shi_7 = substr_count(implode(',',$s),'7');
		$shi_8 = substr_count(implode(',',$s),'8');
		$shi_9 = substr_count(implode(',',$s),'9');

		$ge_0 = substr_count(implode(',',$g),'0');
		$ge_1 = substr_count(implode(',',$g),'1');
		$ge_2 = substr_count(implode(',',$g),'2');
		$ge_3 = substr_count(implode(',',$g),'3');
		$ge_4 = substr_count(implode(',',$g),'4');
		$ge_5 = substr_count(implode(',',$g),'5');
		$ge_6 = substr_count(implode(',',$g),'6');
		$ge_7 = substr_count(implode(',',$g),'7');
		$ge_8 = substr_count(implode(',',$g),'8');
		$ge_9 = substr_count(implode(',',$g),'9');

		$fenbu_0 = $wan_0+$qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_1 = $wan_1+$qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_2 = $wan_2+$qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_3 = $wan_3+$qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_4 = $wan_4+$qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_5 = $wan_5+$qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_6 = $wan_6+$qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_7 = $wan_7+$qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_8 = $wan_8+$qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_9 = $wan_9+$qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_0',$fenbu_0);
		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);

		$fenbu_03 = $qian_0+$bai_0+$shi_0+$ge_0;
		$fenbu_13 = $qian_1+$bai_1+$shi_1+$ge_1;
		$fenbu_23 = $qian_2+$bai_2+$shi_2+$ge_2;
		$fenbu_33 = $qian_3+$bai_3+$shi_3+$ge_3;
		$fenbu_43 = $qian_4+$bai_4+$shi_4+$ge_4;
		$fenbu_53 = $qian_5+$bai_5+$shi_5+$ge_5;
		$fenbu_63 = $qian_6+$bai_6+$shi_6+$ge_6;
		$fenbu_73 = $qian_7+$bai_7+$shi_7+$ge_7;
		$fenbu_83 = $qian_8+$bai_8+$shi_8+$ge_8;
		$fenbu_93 = $qian_9+$bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_03',$fenbu_03);
		$this->assign('fenbu_13',$fenbu_13);
		$this->assign('fenbu_23',$fenbu_23);
		$this->assign('fenbu_33',$fenbu_33);
		$this->assign('fenbu_43',$fenbu_43);
		$this->assign('fenbu_53',$fenbu_53);
		$this->assign('fenbu_63',$fenbu_63);
		$this->assign('fenbu_73',$fenbu_73);
		$this->assign('fenbu_83',$fenbu_83);
		$this->assign('fenbu_93',$fenbu_93);

		$fenbu_04 = $wan_0+$qian_0+$bai_0;
		$fenbu_14 = $wan_1+$qian_1+$bai_1;
		$fenbu_24 = $wan_2+$qian_2+$bai_2;
		$fenbu_34 = $wan_3+$qian_3+$bai_3;
		$fenbu_44 = $wan_4+$qian_4+$bai_4;
		$fenbu_54 = $wan_5+$qian_5+$bai_5;
		$fenbu_64 = $wan_6+$qian_6+$bai_6;
		$fenbu_74 = $wan_7+$qian_7+$bai_7;
		$fenbu_84 = $wan_8+$qian_8+$bai_8;
		$fenbu_94 = $wan_9+$qian_9+$bai_9;

		$this->assign('fenbu_04',$fenbu_04);
		$this->assign('fenbu_14',$fenbu_14);
		$this->assign('fenbu_24',$fenbu_24);
		$this->assign('fenbu_34',$fenbu_34);
		$this->assign('fenbu_44',$fenbu_44);
		$this->assign('fenbu_54',$fenbu_54);
		$this->assign('fenbu_64',$fenbu_64);
		$this->assign('fenbu_74',$fenbu_74);
		$this->assign('fenbu_84',$fenbu_84);
		$this->assign('fenbu_94',$fenbu_94);

		$fenbu_05 = $qian_0+$bai_0+$shi_0;
		$fenbu_15 = $qian_1+$bai_1+$shi_1;
		$fenbu_25 = $qian_2+$bai_2+$shi_2;
		$fenbu_35 = $qian_3+$bai_3+$shi_3;
		$fenbu_45 = $qian_4+$bai_4+$shi_4;
		$fenbu_55 = $qian_5+$bai_5+$shi_5;
		$fenbu_65 = $qian_6+$bai_6+$shi_6;
		$fenbu_75 = $qian_7+$bai_7+$shi_7;
		$fenbu_85 = $qian_8+$bai_8+$shi_8;
		$fenbu_95 = $qian_9+$bai_9+$shi_9;

		$this->assign('fenbu_05',$fenbu_05);
		$this->assign('fenbu_15',$fenbu_15);
		$this->assign('fenbu_25',$fenbu_25);
		$this->assign('fenbu_35',$fenbu_35);
		$this->assign('fenbu_45',$fenbu_45);
		$this->assign('fenbu_55',$fenbu_55);
		$this->assign('fenbu_65',$fenbu_65);
		$this->assign('fenbu_75',$fenbu_75);
		$this->assign('fenbu_85',$fenbu_85);
		$this->assign('fenbu_95',$fenbu_95);

		$fenbu_06 = $bai_0+$shi_0+$ge_0;
		$fenbu_16 = $bai_1+$shi_1+$ge_1;
		$fenbu_26 = $bai_2+$shi_2+$ge_2;
		$fenbu_36 = $bai_3+$shi_3+$ge_3;
		$fenbu_46 = $bai_4+$shi_4+$ge_4;
		$fenbu_56 = $bai_5+$shi_5+$ge_5;
		$fenbu_66 = $bai_6+$shi_6+$ge_6;
		$fenbu_76 = $bai_7+$shi_7+$ge_7;
		$fenbu_86 = $bai_8+$shi_8+$ge_8;
		$fenbu_96 = $bai_9+$shi_9+$ge_9;

		$fenbu_07 = $wan_0+$qian_0;
		$fenbu_17 = $wan_1+$qian_1;
		$fenbu_27 = $wan_2+$qian_2;
		$fenbu_37 = $wan_3+$qian_3;
		$fenbu_47 = $wan_4+$qian_4;
		$fenbu_57 = $wan_5+$qian_5;
		$fenbu_67 = $wan_6+$qian_6;
		$fenbu_77 = $wan_7+$qian_7;
		$fenbu_87 = $wan_8+$qian_8;
		$fenbu_97 = $wan_9+$qian_9;

		$this->assign('fenbu_07',$fenbu_07);
		$this->assign('fenbu_17',$fenbu_17);
		$this->assign('fenbu_27',$fenbu_27);
		$this->assign('fenbu_37',$fenbu_37);
		$this->assign('fenbu_47',$fenbu_47);
		$this->assign('fenbu_57',$fenbu_57);
		$this->assign('fenbu_67',$fenbu_67);
		$this->assign('fenbu_77',$fenbu_77);
		$this->assign('fenbu_87',$fenbu_87);
		$this->assign('fenbu_97',$fenbu_97);

		$fenbu_08 = $shi_0+$ge_0;
		$fenbu_18 = $shi_1+$ge_1;
		$fenbu_28 = $shi_2+$ge_2;
		$fenbu_38 = $shi_3+$ge_3;
		$fenbu_48 = $shi_4+$ge_4;
		$fenbu_58 = $shi_5+$ge_5;
		$fenbu_68 = $shi_6+$ge_6;
		$fenbu_78 = $shi_7+$ge_7;
		$fenbu_88 = $shi_8+$ge_8;
		$fenbu_98 = $shi_9+$ge_9;

		$this->assign('fenbu_08',$fenbu_08);
		$this->assign('fenbu_18',$fenbu_18);
		$this->assign('fenbu_28',$fenbu_28);
		$this->assign('fenbu_38',$fenbu_38);
		$this->assign('fenbu_48',$fenbu_48);
		$this->assign('fenbu_58',$fenbu_58);
		$this->assign('fenbu_68',$fenbu_68);
		$this->assign('fenbu_78',$fenbu_78);
		$this->assign('fenbu_88',$fenbu_88);
		$this->assign('fenbu_98',$fenbu_98);

		$this->assign('fenbu_06',$fenbu_06);
		$this->assign('fenbu_16',$fenbu_16);
		$this->assign('fenbu_26',$fenbu_26);
		$this->assign('fenbu_36',$fenbu_36);
		$this->assign('fenbu_46',$fenbu_46);
		$this->assign('fenbu_56',$fenbu_56);
		$this->assign('fenbu_66',$fenbu_66);
		$this->assign('fenbu_76',$fenbu_76);
		$this->assign('fenbu_86',$fenbu_86);
		$this->assign('fenbu_96',$fenbu_96);

		$this->assign('wan_9',$wan_9);
		$this->assign('wan_8',$wan_8);
		$this->assign('wan_7',$wan_7);
		$this->assign('wan_6',$wan_6);
		$this->assign('wan_5',$wan_5);
		$this->assign('wan_4',$wan_4);
		$this->assign('wan_3',$wan_3);
		$this->assign('wan_2',$wan_2);
		$this->assign('wan_1',$wan_1);
		$this->assign('wan_0',$wan_0);

		$this->assign('qian_0',$qian_0);
		$this->assign('qian_1',$qian_1);
		$this->assign('qian_2',$qian_2);
		$this->assign('qian_3',$qian_3);
		$this->assign('qian_4',$qian_4);
		$this->assign('qian_5',$qian_5);
		$this->assign('qian_6',$qian_6);
		$this->assign('qian_7',$qian_7);
		$this->assign('qian_8',$qian_8);
		$this->assign('qian_9',$qian_9);

		$this->assign('bai_0',$bai_0);
		$this->assign('bai_1',$bai_1);
		$this->assign('bai_2',$bai_2);
		$this->assign('bai_3',$bai_3);
		$this->assign('bai_4',$bai_4);
		$this->assign('bai_5',$bai_5);
		$this->assign('bai_6',$bai_6);
		$this->assign('bai_7',$bai_7);
		$this->assign('bai_8',$bai_8);
		$this->assign('bai_9',$bai_9);

		$this->assign('shi_0',$shi_0);
		$this->assign('shi_1',$shi_1);
		$this->assign('shi_2',$shi_2);
		$this->assign('shi_3',$shi_3);
		$this->assign('shi_4',$shi_4);
		$this->assign('shi_5',$shi_5);
		$this->assign('shi_6',$shi_6);
		$this->assign('shi_7',$shi_7);
		$this->assign('shi_8',$shi_8);
		$this->assign('shi_9',$shi_9);

		$this->assign('ge_0',$ge_0);
		$this->assign('ge_1',$ge_1);
		$this->assign('ge_2',$ge_2);
		$this->assign('ge_3',$ge_3);
		$this->assign('ge_4',$ge_4);
		$this->assign('ge_5',$ge_5);
		$this->assign('ge_6',$ge_6);
		$this->assign('ge_7',$ge_7);
		$this->assign('ge_8',$ge_8);
		$this->assign('ge_9',$ge_9);

		//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$w_0 = intval($zhanshi_qishu/$wan_0);
		$w_1 = intval($zhanshi_qishu/$wan_1);
		$w_2 = intval($zhanshi_qishu/$wan_2);
		$w_3 = intval($zhanshi_qishu/$wan_3);
		$w_4 = intval($zhanshi_qishu/$wan_4);
		$w_5 = intval($zhanshi_qishu/$wan_5);
		$w_6 = intval($zhanshi_qishu/$wan_6);
		$w_7 = intval($zhanshi_qishu/$wan_7);
		$w_8 = intval($zhanshi_qishu/$wan_8);
		$w_9 = intval($zhanshi_qishu/$wan_9);
		$this->assign('w_0',$w_0);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);

		$q_0 = intval($zhanshi_qishu/$qian_0);
		$q_1 = intval($zhanshi_qishu/$qian_1);
		$q_2 = intval($zhanshi_qishu/$qian_2);
		$q_3 = intval($zhanshi_qishu/$qian_3);
		$q_4 = intval($zhanshi_qishu/$qian_4);
		$q_5 = intval($zhanshi_qishu/$qian_5);
		$q_6 = intval($zhanshi_qishu/$qian_6);
		$q_7 = intval($zhanshi_qishu/$qian_7);
		$q_8 = intval($zhanshi_qishu/$qian_8);
		$q_9 = intval($zhanshi_qishu/$qian_9);
		$this->assign('q_0',$q_0);
		$this->assign('q_1',$q_1);
		$this->assign('q_2',$q_2);
		$this->assign('q_3',$q_3);
		$this->assign('q_4',$q_4);
		$this->assign('q_5',$q_5);
		$this->assign('q_6',$q_6);
		$this->assign('q_7',$q_7);
		$this->assign('q_8',$q_8);
		$this->assign('q_9',$q_9);

		$b_0 = intval($zhanshi_qishu/$bai_0);
		$b_1 = intval($zhanshi_qishu/$bai_1);
		$b_2 = intval($zhanshi_qishu/$bai_2);
		$b_3 = intval($zhanshi_qishu/$bai_3);
		$b_4 = intval($zhanshi_qishu/$bai_4);
		$b_5 = intval($zhanshi_qishu/$bai_5);
		$b_6 = intval($zhanshi_qishu/$bai_6);
		$b_7 = intval($zhanshi_qishu/$bai_7);
		$b_8 = intval($zhanshi_qishu/$bai_8);
		$b_9 = intval($zhanshi_qishu/$bai_9);
		$this->assign('b_0',$b_0);
		$this->assign('b_1',$b_1);
		$this->assign('b_2',$b_2);
		$this->assign('b_3',$b_3);
		$this->assign('b_4',$b_4);
		$this->assign('b_5',$b_5);
		$this->assign('b_6',$b_6);
		$this->assign('b_7',$b_7);
		$this->assign('b_8',$b_8);
		$this->assign('b_9',$b_9);

		$s_0 = intval($zhanshi_qishu/$shi_0);
		$s_1 = intval($zhanshi_qishu/$shi_1);
		$s_2 = intval($zhanshi_qishu/$shi_2);
		$s_3 = intval($zhanshi_qishu/$shi_3);
		$s_4 = intval($zhanshi_qishu/$shi_4);
		$s_5 = intval($zhanshi_qishu/$shi_5);
		$s_6 = intval($zhanshi_qishu/$shi_6);
		$s_7 = intval($zhanshi_qishu/$shi_7);
		$s_8 = intval($zhanshi_qishu/$shi_8);
		$s_9 = intval($zhanshi_qishu/$shi_9);
		$this->assign('s_0',$s_0);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);

		$g_0 = intval($zhanshi_qishu/$ge_0);
		$g_1 = intval($zhanshi_qishu/$ge_1);
		$g_2 = intval($zhanshi_qishu/$ge_2);
		$g_3 = intval($zhanshi_qishu/$ge_3);
		$g_4 = intval($zhanshi_qishu/$ge_4);
		$g_5 = intval($zhanshi_qishu/$ge_5);
		$g_6 = intval($zhanshi_qishu/$ge_6);
		$g_7 = intval($zhanshi_qishu/$ge_7);
		$g_8 = intval($zhanshi_qishu/$ge_8);
		$g_9 = intval($zhanshi_qishu/$ge_9);
		$this->assign('g_0',$g_0);
		$this->assign('g_1',$g_1);
		$this->assign('g_2',$g_2);
		$this->assign('g_3',$g_3);
		$this->assign('g_4',$g_4);
		$this->assign('g_5',$g_5);
		$this->assign('g_6',$g_6);
		$this->assign('g_7',$g_7);
		$this->assign('g_8',$g_8);
		$this->assign('g_9',$g_9);

		$fen_0 = intval($zhanshi_qishu/$fenbu_0);
		$fen_1 = intval($zhanshi_qishu/$fenbu_1);
		$fen_2 = intval($zhanshi_qishu/$fenbu_2);
		$fen_3 = intval($zhanshi_qishu/$fenbu_3);
		$fen_4 = intval($zhanshi_qishu/$fenbu_4);
		$fen_5 = intval($zhanshi_qishu/$fenbu_5);
		$fen_6 = intval($zhanshi_qishu/$fenbu_6);
		$fen_7 = intval($zhanshi_qishu/$fenbu_7);
		$fen_8 = intval($zhanshi_qishu/$fenbu_8);
		$fen_9 = intval($zhanshi_qishu/$fenbu_9);
		$this->assign('fen_0',$fen_0);
		$this->assign('fen_1',$fen_1);
		$this->assign('fen_2',$fen_2);
		$this->assign('fen_3',$fen_3);
		$this->assign('fen_4',$fen_4);
		$this->assign('fen_5',$fen_5);
		$this->assign('fen_6',$fen_6);
		$this->assign('fen_7',$fen_7);
		$this->assign('fen_8',$fen_8);
		$this->assign('fen_9',$fen_9);

		$fen_03 = intval($zhanshi_qishu/$fenbu_03);
		$fen_13 = intval($zhanshi_qishu/$fenbu_13);
		$fen_23 = intval($zhanshi_qishu/$fenbu_23);
		$fen_33 = intval($zhanshi_qishu/$fenbu_33);
		$fen_43 = intval($zhanshi_qishu/$fenbu_43);
		$fen_53 = intval($zhanshi_qishu/$fenbu_53);
		$fen_63 = intval($zhanshi_qishu/$fenbu_63);
		$fen_73 = intval($zhanshi_qishu/$fenbu_73);
		$fen_83 = intval($zhanshi_qishu/$fenbu_83);
		$fen_93 = intval($zhanshi_qishu/$fenbu_93);
		$this->assign('fen_03',$fen_03);
		$this->assign('fen_13',$fen_13);
		$this->assign('fen_23',$fen_23);
		$this->assign('fen_33',$fen_33);
		$this->assign('fen_43',$fen_43);
		$this->assign('fen_53',$fen_53);
		$this->assign('fen_63',$fen_63);
		$this->assign('fen_73',$fen_73);
		$this->assign('fen_83',$fen_83);
		$this->assign('fen_93',$fen_93);

		$fen_04 = intval($zhanshi_qishu/$fenbu_04);
		$fen_14 = intval($zhanshi_qishu/$fenbu_14);
		$fen_24 = intval($zhanshi_qishu/$fenbu_24);
		$fen_34 = intval($zhanshi_qishu/$fenbu_34);
		$fen_44 = intval($zhanshi_qishu/$fenbu_44);
		$fen_54 = intval($zhanshi_qishu/$fenbu_54);
		$fen_64 = intval($zhanshi_qishu/$fenbu_64);
		$fen_74 = intval($zhanshi_qishu/$fenbu_74);
		$fen_84 = intval($zhanshi_qishu/$fenbu_84);
		$fen_94 = intval($zhanshi_qishu/$fenbu_94);
		$this->assign('fen_04',$fen_04);
		$this->assign('fen_14',$fen_14);
		$this->assign('fen_24',$fen_24);
		$this->assign('fen_34',$fen_34);
		$this->assign('fen_44',$fen_44);
		$this->assign('fen_54',$fen_54);
		$this->assign('fen_64',$fen_64);
		$this->assign('fen_74',$fen_74);
		$this->assign('fen_84',$fen_84);
		$this->assign('fen_94',$fen_94);

		$fen_05 = intval($zhanshi_qishu/$fenbu_05);
		$fen_15 = intval($zhanshi_qishu/$fenbu_15);
		$fen_25 = intval($zhanshi_qishu/$fenbu_25);
		$fen_35 = intval($zhanshi_qishu/$fenbu_35);
		$fen_45 = intval($zhanshi_qishu/$fenbu_45);
		$fen_55 = intval($zhanshi_qishu/$fenbu_55);
		$fen_65 = intval($zhanshi_qishu/$fenbu_65);
		$fen_75 = intval($zhanshi_qishu/$fenbu_75);
		$fen_85 = intval($zhanshi_qishu/$fenbu_85);
		$fen_95 = intval($zhanshi_qishu/$fenbu_95);
		$this->assign('fen_05',$fen_05);
		$this->assign('fen_15',$fen_15);
		$this->assign('fen_25',$fen_25);
		$this->assign('fen_35',$fen_35);
		$this->assign('fen_45',$fen_45);
		$this->assign('fen_55',$fen_55);
		$this->assign('fen_65',$fen_65);
		$this->assign('fen_75',$fen_75);
		$this->assign('fen_85',$fen_85);
		$this->assign('fen_95',$fen_95);

		$fen_06 = intval($zhanshi_qishu/$fenbu_06);
		$fen_16 = intval($zhanshi_qishu/$fenbu_16);
		$fen_26 = intval($zhanshi_qishu/$fenbu_26);
		$fen_36 = intval($zhanshi_qishu/$fenbu_36);
		$fen_46 = intval($zhanshi_qishu/$fenbu_46);
		$fen_56 = intval($zhanshi_qishu/$fenbu_56);
		$fen_66 = intval($zhanshi_qishu/$fenbu_66);
		$fen_76 = intval($zhanshi_qishu/$fenbu_76);
		$fen_86 = intval($zhanshi_qishu/$fenbu_86);
		$fen_96 = intval($zhanshi_qishu/$fenbu_96);
		$this->assign('fen_06',$fen_06);
		$this->assign('fen_16',$fen_16);
		$this->assign('fen_26',$fen_26);
		$this->assign('fen_36',$fen_36);
		$this->assign('fen_46',$fen_46);
		$this->assign('fen_56',$fen_56);
		$this->assign('fen_66',$fen_66);
		$this->assign('fen_76',$fen_76);
		$this->assign('fen_86',$fen_86);
		$this->assign('fen_96',$fen_96);

		$fen_07 = intval($zhanshi_qishu/$fenbu_07);
		$fen_17 = intval($zhanshi_qishu/$fenbu_17);
		$fen_27 = intval($zhanshi_qishu/$fenbu_27);
		$fen_37 = intval($zhanshi_qishu/$fenbu_37);
		$fen_47 = intval($zhanshi_qishu/$fenbu_47);
		$fen_57 = intval($zhanshi_qishu/$fenbu_57);
		$fen_67 = intval($zhanshi_qishu/$fenbu_67);
		$fen_77 = intval($zhanshi_qishu/$fenbu_77);
		$fen_87 = intval($zhanshi_qishu/$fenbu_87);
		$fen_97= intval($zhanshi_qishu/$fenbu_97);
		$this->assign('fen_07',$fen_07);
		$this->assign('fen_17',$fen_17);
		$this->assign('fen_27',$fen_27);
		$this->assign('fen_37',$fen_37);
		$this->assign('fen_47',$fen_47);
		$this->assign('fen_57',$fen_57);
		$this->assign('fen_67',$fen_67);
		$this->assign('fen_77',$fen_77);
		$this->assign('fen_87',$fen_87);
		$this->assign('fen_97',$fen_97);

		$fen_08 = intval($zhanshi_qishu/$fenbu_08);
		$fen_18 = intval($zhanshi_qishu/$fenbu_18);
		$fen_28 = intval($zhanshi_qishu/$fenbu_28);
		$fen_38 = intval($zhanshi_qishu/$fenbu_38);
		$fen_48 = intval($zhanshi_qishu/$fenbu_48);
		$fen_58 = intval($zhanshi_qishu/$fenbu_58);
		$fen_68 = intval($zhanshi_qishu/$fenbu_68);
		$fen_78 = intval($zhanshi_qishu/$fenbu_78);
		$fen_88 = intval($zhanshi_qishu/$fenbu_88);
		$fen_98 = intval($zhanshi_qishu/$fenbu_98);
		$this->assign('fen_08',$fen_08);
		$this->assign('fen_18',$fen_18);
		$this->assign('fen_28',$fen_28);
		$this->assign('fen_38',$fen_38);
		$this->assign('fen_48',$fen_48);
		$this->assign('fen_58',$fen_58);
		$this->assign('fen_68',$fen_68);
		$this->assign('fen_78',$fen_78);
		$this->assign('fen_88',$fen_88);
		$this->assign('fen_98',$fen_98);

		$ku_0 = intval($zhanshi_qishu/$kua_0);
		$ku_1 = intval($zhanshi_qishu/$kua_1);
		$ku_2 = intval($zhanshi_qishu/$kua_2);
		$ku_3 = intval($zhanshi_qishu/$kua_3);
		$ku_4 = intval($zhanshi_qishu/$kua_4);
		$ku_5 = intval($zhanshi_qishu/$kua_5);
		$ku_6 = intval($zhanshi_qishu/$kua_6);
		$ku_7 = intval($zhanshi_qishu/$kua_7);
		$ku_8 = intval($zhanshi_qishu/$kua_8);
		$ku_9 = intval($zhanshi_qishu/$kua_9);
		$this->assign('ku_0',$ku_0);
		$this->assign('ku_1',$ku_1);
		$this->assign('ku_2',$ku_2);
		$this->assign('ku_3',$ku_3);
		$this->assign('ku_4',$ku_4);
		$this->assign('ku_5',$ku_5);
		$this->assign('ku_6',$ku_6);
		$this->assign('ku_7',$ku_7);
		$this->assign('ku_8',$ku_8);
		$this->assign('ku_9',$ku_9);

		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);

		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

		$this->assign('qishu',$qishu);
		$this->assign('maifa',$maifa);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function ajssc_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='ffc2'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='ffc2'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='ffc2'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();

		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "埃及二分彩报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}


	//广东11x5走势图列表
	public function trendChart_gdsyx5(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gd11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gd11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gd11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$diyi[] = $v[0].$v[1];
			$dier[] = $v[3].$v[4];
			$disan[] = $v[6].$v[7];
			$disi[] = $v[9].$v[10];
			$diwu[] = $v[12].$v[13];
		}

		$diyi_1 = substr_count(implode(',',$diyi),'01');
		$diyi_2 = substr_count(implode(',',$diyi),'02');
		$diyi_3 = substr_count(implode(',',$diyi),'03');
		$diyi_4 = substr_count(implode(',',$diyi),'04');
		$diyi_5 = substr_count(implode(',',$diyi),'05');
		$diyi_6 = substr_count(implode(',',$diyi),'06');
		$diyi_7 = substr_count(implode(',',$diyi),'07');
		$diyi_8 = substr_count(implode(',',$diyi),'08');
		$diyi_9 = substr_count(implode(',',$diyi),'09');
		$diyi_10 = substr_count(implode(',',$diyi),'10');
		$diyi_11 = substr_count(implode(',',$diyi),'11');
		$this->assign('diyi_1',$diyi_1);
		$this->assign('diyi_2',$diyi_2);
		$this->assign('diyi_3',$diyi_3);
		$this->assign('diyi_4',$diyi_4);
		$this->assign('diyi_5',$diyi_5);
		$this->assign('diyi_6',$diyi_6);
		$this->assign('diyi_7',$diyi_7);
		$this->assign('diyi_8',$diyi_8);
		$this->assign('diyi_9',$diyi_9);
		$this->assign('diyi_10',$diyi_10);
		$this->assign('diyi_11',$diyi_11);

		$dier_1 = substr_count(implode(',',$dier),'01');
		$dier_2 = substr_count(implode(',',$dier),'02');
		$dier_3 = substr_count(implode(',',$dier),'03');
		$dier_4 = substr_count(implode(',',$dier),'04');
		$dier_5 = substr_count(implode(',',$dier),'05');
		$dier_6 = substr_count(implode(',',$dier),'06');
		$dier_7 = substr_count(implode(',',$dier),'07');
		$dier_8 = substr_count(implode(',',$dier),'08');
		$dier_9 = substr_count(implode(',',$dier),'09');
		$dier_10 = substr_count(implode(',',$dier),'10');
		$dier_11 = substr_count(implode(',',$dier),'11');
		$this->assign('dier_1',$dier_1);
		$this->assign('dier_2',$dier_2);
		$this->assign('dier_3',$dier_3);
		$this->assign('dier_4',$dier_4);
		$this->assign('dier_5',$dier_5);
		$this->assign('dier_6',$dier_6);
		$this->assign('dier_7',$dier_7);
		$this->assign('dier_8',$dier_8);
		$this->assign('dier_9',$dier_9);
		$this->assign('dier_10',$dier_10);
		$this->assign('dier_11',$dier_11);

		$disan_1 = substr_count(implode(',',$disan),'01');
		$disan_2 = substr_count(implode(',',$disan),'02');
		$disan_3 = substr_count(implode(',',$disan),'03');
		$disan_4 = substr_count(implode(',',$disan),'04');
		$disan_5 = substr_count(implode(',',$disan),'05');
		$disan_6 = substr_count(implode(',',$disan),'06');
		$disan_7 = substr_count(implode(',',$disan),'07');
		$disan_8 = substr_count(implode(',',$disan),'08');
		$disan_9 = substr_count(implode(',',$disan),'09');
		$disan_10 = substr_count(implode(',',$disan),'10');
		$disan_11 = substr_count(implode(',',$disan),'11');
		$this->assign('disan_1',$disan_1);
		$this->assign('disan_2',$disan_2);
		$this->assign('disan_3',$disan_3);
		$this->assign('disan_4',$disan_4);
		$this->assign('disan_5',$disan_5);
		$this->assign('disan_6',$disan_6);
		$this->assign('disan_7',$disan_7);
		$this->assign('disan_8',$disan_8);
		$this->assign('disan_9',$disan_9);
		$this->assign('disan_10',$disan_10);
		$this->assign('disan_11',$disan_11);

		$disi_1 = substr_count(implode(',',$disi),'01');
		$disi_2 = substr_count(implode(',',$disi),'02');
		$disi_3 = substr_count(implode(',',$disi),'03');
		$disi_4 = substr_count(implode(',',$disi),'04');
		$disi_5 = substr_count(implode(',',$disi),'05');
		$disi_6 = substr_count(implode(',',$disi),'06');
		$disi_7 = substr_count(implode(',',$disi),'07');
		$disi_8 = substr_count(implode(',',$disi),'08');
		$disi_9 = substr_count(implode(',',$disi),'09');
		$disi_10 = substr_count(implode(',',$disi),'10');
		$disi_11 = substr_count(implode(',',$disi),'11');
		$this->assign('disi_1',$disi_1);
		$this->assign('disi_2',$disi_2);
		$this->assign('disi_3',$disi_3);
		$this->assign('disi_4',$disi_4);
		$this->assign('disi_5',$disi_5);
		$this->assign('disi_6',$disi_6);
		$this->assign('disi_7',$disi_7);
		$this->assign('disi_8',$disi_8);
		$this->assign('disi_9',$disi_9);
		$this->assign('disi_10',$disi_10);
		$this->assign('disi_11',$disi_11);

		$diwu_1 = substr_count(implode(',',$diwu),'01');
		$diwu_2 = substr_count(implode(',',$diwu),'02');
		$diwu_3 = substr_count(implode(',',$diwu),'03');
		$diwu_4 = substr_count(implode(',',$diwu),'04');
		$diwu_5 = substr_count(implode(',',$diwu),'05');
		$diwu_6 = substr_count(implode(',',$diwu),'06');
		$diwu_7 = substr_count(implode(',',$diwu),'07');
		$diwu_8 = substr_count(implode(',',$diwu),'08');
		$diwu_9 = substr_count(implode(',',$diwu),'09');
		$diwu_10 = substr_count(implode(',',$diwu),'10');
		$diwu_11 = substr_count(implode(',',$diwu),'11');
		$this->assign('diwu_1',$diwu_1);
		$this->assign('diwu_2',$diwu_2);
		$this->assign('diwu_3',$diwu_3);
		$this->assign('diwu_4',$diwu_4);
		$this->assign('diwu_5',$diwu_5);
		$this->assign('diwu_6',$diwu_6);
		$this->assign('diwu_7',$diwu_7);
		$this->assign('diwu_8',$diwu_8);
		$this->assign('diwu_9',$diwu_9);
		$this->assign('diwu_10',$diwu_10);
		$this->assign('diwu_11',$diwu_11);

		//分布
		$fenbu_1 = $diyi_1+$dier_1+$disan_1+$disi_1+$diwu_1;
		$fenbu_2 = $diyi_2+$dier_2+$disan_2+$disi_2+$diwu_2;
		$fenbu_3 = $diyi_3+$dier_3+$disan_3+$disi_3+$diwu_3;
		$fenbu_4 = $diyi_4+$dier_4+$disan_4+$disi_4+$diwu_4;
		$fenbu_5 = $diyi_5+$dier_5+$disan_5+$disi_5+$diwu_5;
		$fenbu_6 = $diyi_6+$dier_6+$disan_6+$disi_6+$diwu_6;
		$fenbu_7 = $diyi_7+$dier_7+$disan_7+$disi_7+$diwu_7;
		$fenbu_8 = $diyi_8+$dier_8+$disan_8+$disi_8+$diwu_8;
		$fenbu_9 = $diyi_9+$dier_9+$disan_9+$disi_9+$diwu_9;
		$fenbu_10 = $diyi_10+$dier_10+$disan_10+$disi_10+$diwu_10;
		$fenbu_11 = $diyi_11+$dier_11+$disan_11+$disi_11+$diwu_11;

		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);
		$this->assign('fenbu_10',$fenbu_10);
		$this->assign('fenbu_11',$fenbu_11);



		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$y_1 = intval($zhanshi_qishu/$diyi_1);
		$y_2 = intval($zhanshi_qishu/$diyi_2);
		$y_3 = intval($zhanshi_qishu/$diyi_3);
		$y_4 = intval($zhanshi_qishu/$diyi_4);
		$y_5 = intval($zhanshi_qishu/$diyi_5);
		$y_6 = intval($zhanshi_qishu/$diyi_6);
		$y_7 = intval($zhanshi_qishu/$diyi_7);
		$y_8 = intval($zhanshi_qishu/$diyi_8);
		$y_9 = intval($zhanshi_qishu/$diyi_9);
		$y_10 = intval($zhanshi_qishu/$diyi_10);
		$y_11 = intval($zhanshi_qishu/$diyi_11);
		$this->assign('y_1',$y_1);
		$this->assign('y_2',$y_2);
		$this->assign('y_3',$y_3);
		$this->assign('y_4',$y_4);
		$this->assign('y_5',$y_5);
		$this->assign('y_6',$y_6);
		$this->assign('y_7',$y_7);
		$this->assign('y_8',$y_8);
		$this->assign('y_9',$y_9);
		$this->assign('y_10',$y_10);
		$this->assign('y_11',$y_11);

		$e_1 = intval($zhanshi_qishu/$dier_1);
		$e_2 = intval($zhanshi_qishu/$dier_2);
		$e_3 = intval($zhanshi_qishu/$dier_3);
		$e_4 = intval($zhanshi_qishu/$dier_4);
		$e_5 = intval($zhanshi_qishu/$dier_5);
		$e_6 = intval($zhanshi_qishu/$dier_6);
		$e_7 = intval($zhanshi_qishu/$dier_7);
		$e_8 = intval($zhanshi_qishu/$dier_8);
		$e_9 = intval($zhanshi_qishu/$dier_9);
		$e_10 = intval($zhanshi_qishu/$dier_10);
		$e_11 = intval($zhanshi_qishu/$dier_11);
		$this->assign('e_1',$e_1);
		$this->assign('e_2',$e_2);
		$this->assign('e_3',$e_3);
		$this->assign('e_4',$e_4);
		$this->assign('e_5',$e_5);
		$this->assign('e_6',$e_6);
		$this->assign('e_7',$e_7);
		$this->assign('e_8',$e_8);
		$this->assign('e_9',$e_9);
		$this->assign('e_10',$e_10);
		$this->assign('e_11',$e_11);
		$s_1 = intval($zhanshi_qishu/$disan_1);
		$s_2 = intval($zhanshi_qishu/$disan_2);
		$s_3 = intval($zhanshi_qishu/$disan_3);
		$s_4 = intval($zhanshi_qishu/$disan_4);
		$s_5 = intval($zhanshi_qishu/$disan_5);
		$s_6 = intval($zhanshi_qishu/$disan_6);
		$s_7 = intval($zhanshi_qishu/$disan_7);
		$s_8 = intval($zhanshi_qishu/$disan_8);
		$s_9 = intval($zhanshi_qishu/$disan_9);
		$s_10 = intval($zhanshi_qishu/$disan_10);
		$s_11 = intval($zhanshi_qishu/$disan_11);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);
		$this->assign('s_10',$s_10);
		$this->assign('s_11',$s_11);


		$ss_1 = intval($zhanshi_qishu/$disi_1);
		$ss_2 = intval($zhanshi_qishu/$disi_2);
		$ss_3 = intval($zhanshi_qishu/$disi_3);
		$ss_4 = intval($zhanshi_qishu/$disi_4);
		$ss_5 = intval($zhanshi_qishu/$disi_5);
		$ss_6 = intval($zhanshi_qishu/$disi_6);
		$ss_7 = intval($zhanshi_qishu/$disi_7);
		$ss_8 = intval($zhanshi_qishu/$disi_8);
		$ss_9 = intval($zhanshi_qishu/$disi_9);
		$ss_10 = intval($zhanshi_qishu/$disi_10);
		$ss_11 = intval($zhanshi_qishu/$disi_11);
		$this->assign('ss_1',$ss_1);
		$this->assign('ss_2',$ss_2);
		$this->assign('ss_3',$ss_3);
		$this->assign('ss_4',$ss_4);
		$this->assign('ss_5',$ss_5);
		$this->assign('ss_6',$ss_6);
		$this->assign('ss_7',$ss_7);
		$this->assign('ss_8',$ss_8);
		$this->assign('ss_9',$ss_9);
		$this->assign('ss_10',$ss_10);
		$this->assign('ss_11',$ss_11);

		$w_1 = intval($zhanshi_qishu/$diwu_1);
		$w_2 = intval($zhanshi_qishu/$diwu_2);
		$w_3 = intval($zhanshi_qishu/$diwu_3);
		$w_4 = intval($zhanshi_qishu/$diwu_4);
		$w_5 = intval($zhanshi_qishu/$diwu_5);
		$w_6 = intval($zhanshi_qishu/$diwu_6);
		$w_7 = intval($zhanshi_qishu/$diwu_7);
		$w_8 = intval($zhanshi_qishu/$diwu_8);
		$w_9 = intval($zhanshi_qishu/$diwu_9);
		$w_10 = intval($zhanshi_qishu/$diwu_10);
		$w_11 = intval($zhanshi_qishu/$diwu_11);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);
		$this->assign('w_10',$w_10);
		$this->assign('w_11',$w_11);

		$f_1 = intval($zhanshi_qishu/$fenbu_1);
		$f_2 = intval($zhanshi_qishu/$fenbu_2);
		$f_3 = intval($zhanshi_qishu/$fenbu_3);
		$f_4 = intval($zhanshi_qishu/$fenbu_4);
		$f_5 = intval($zhanshi_qishu/$fenbu_5);
		$f_6 = intval($zhanshi_qishu/$fenbu_6);
		$f_7 = intval($zhanshi_qishu/$fenbu_7);
		$f_8 = intval($zhanshi_qishu/$fenbu_8);
		$f_9 = intval($zhanshi_qishu/$fenbu_9);
		$f_10 = intval($zhanshi_qishu/$fenbu_10);
		$f_11 = intval($zhanshi_qishu/$fenbu_11);
		$this->assign('f_1',$f_1);
		$this->assign('f_2',$f_2);
		$this->assign('f_3',$f_3);
		$this->assign('f_4',$f_4);
		$this->assign('f_5',$f_5);
		$this->assign('f_6',$f_6);
		$this->assign('f_7',$f_7);
		$this->assign('f_8',$f_8);
		$this->assign('f_9',$f_9);
		$this->assign('f_10',$f_10);
		$this->assign('f_11',$f_11);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function gdsyx5_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='gd11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='gd11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='gd11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "广东十一选五报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//上海11x5走势图列表
	public function trendChart_shsyx5(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='sh11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='sh11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='sh11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$diyi[] = $v[0].$v[1];
			$dier[] = $v[3].$v[4];
			$disan[] = $v[6].$v[7];
			$disi[] = $v[9].$v[10];
			$diwu[] = $v[12].$v[13];
		}

		$diyi_1 = substr_count(implode(',',$diyi),'01');
		$diyi_2 = substr_count(implode(',',$diyi),'02');
		$diyi_3 = substr_count(implode(',',$diyi),'03');
		$diyi_4 = substr_count(implode(',',$diyi),'04');
		$diyi_5 = substr_count(implode(',',$diyi),'05');
		$diyi_6 = substr_count(implode(',',$diyi),'06');
		$diyi_7 = substr_count(implode(',',$diyi),'07');
		$diyi_8 = substr_count(implode(',',$diyi),'08');
		$diyi_9 = substr_count(implode(',',$diyi),'09');
		$diyi_10 = substr_count(implode(',',$diyi),'10');
		$diyi_11 = substr_count(implode(',',$diyi),'11');
		$this->assign('diyi_1',$diyi_1);
		$this->assign('diyi_2',$diyi_2);
		$this->assign('diyi_3',$diyi_3);
		$this->assign('diyi_4',$diyi_4);
		$this->assign('diyi_5',$diyi_5);
		$this->assign('diyi_6',$diyi_6);
		$this->assign('diyi_7',$diyi_7);
		$this->assign('diyi_8',$diyi_8);
		$this->assign('diyi_9',$diyi_9);
		$this->assign('diyi_10',$diyi_10);
		$this->assign('diyi_11',$diyi_11);

		$dier_1 = substr_count(implode(',',$dier),'01');
		$dier_2 = substr_count(implode(',',$dier),'02');
		$dier_3 = substr_count(implode(',',$dier),'03');
		$dier_4 = substr_count(implode(',',$dier),'04');
		$dier_5 = substr_count(implode(',',$dier),'05');
		$dier_6 = substr_count(implode(',',$dier),'06');
		$dier_7 = substr_count(implode(',',$dier),'07');
		$dier_8 = substr_count(implode(',',$dier),'08');
		$dier_9 = substr_count(implode(',',$dier),'09');
		$dier_10 = substr_count(implode(',',$dier),'10');
		$dier_11 = substr_count(implode(',',$dier),'11');
		$this->assign('dier_1',$dier_1);
		$this->assign('dier_2',$dier_2);
		$this->assign('dier_3',$dier_3);
		$this->assign('dier_4',$dier_4);
		$this->assign('dier_5',$dier_5);
		$this->assign('dier_6',$dier_6);
		$this->assign('dier_7',$dier_7);
		$this->assign('dier_8',$dier_8);
		$this->assign('dier_9',$dier_9);
		$this->assign('dier_10',$dier_10);
		$this->assign('dier_11',$dier_11);

		$disan_1 = substr_count(implode(',',$disan),'01');
		$disan_2 = substr_count(implode(',',$disan),'02');
		$disan_3 = substr_count(implode(',',$disan),'03');
		$disan_4 = substr_count(implode(',',$disan),'04');
		$disan_5 = substr_count(implode(',',$disan),'05');
		$disan_6 = substr_count(implode(',',$disan),'06');
		$disan_7 = substr_count(implode(',',$disan),'07');
		$disan_8 = substr_count(implode(',',$disan),'08');
		$disan_9 = substr_count(implode(',',$disan),'09');
		$disan_10 = substr_count(implode(',',$disan),'10');
		$disan_11 = substr_count(implode(',',$disan),'11');
		$this->assign('disan_1',$disan_1);
		$this->assign('disan_2',$disan_2);
		$this->assign('disan_3',$disan_3);
		$this->assign('disan_4',$disan_4);
		$this->assign('disan_5',$disan_5);
		$this->assign('disan_6',$disan_6);
		$this->assign('disan_7',$disan_7);
		$this->assign('disan_8',$disan_8);
		$this->assign('disan_9',$disan_9);
		$this->assign('disan_10',$disan_10);
		$this->assign('disan_11',$disan_11);

		$disi_1 = substr_count(implode(',',$disi),'01');
		$disi_2 = substr_count(implode(',',$disi),'02');
		$disi_3 = substr_count(implode(',',$disi),'03');
		$disi_4 = substr_count(implode(',',$disi),'04');
		$disi_5 = substr_count(implode(',',$disi),'05');
		$disi_6 = substr_count(implode(',',$disi),'06');
		$disi_7 = substr_count(implode(',',$disi),'07');
		$disi_8 = substr_count(implode(',',$disi),'08');
		$disi_9 = substr_count(implode(',',$disi),'09');
		$disi_10 = substr_count(implode(',',$disi),'10');
		$disi_11 = substr_count(implode(',',$disi),'11');
		$this->assign('disi_1',$disi_1);
		$this->assign('disi_2',$disi_2);
		$this->assign('disi_3',$disi_3);
		$this->assign('disi_4',$disi_4);
		$this->assign('disi_5',$disi_5);
		$this->assign('disi_6',$disi_6);
		$this->assign('disi_7',$disi_7);
		$this->assign('disi_8',$disi_8);
		$this->assign('disi_9',$disi_9);
		$this->assign('disi_10',$disi_10);
		$this->assign('disi_11',$disi_11);

		$diwu_1 = substr_count(implode(',',$diwu),'01');
		$diwu_2 = substr_count(implode(',',$diwu),'02');
		$diwu_3 = substr_count(implode(',',$diwu),'03');
		$diwu_4 = substr_count(implode(',',$diwu),'04');
		$diwu_5 = substr_count(implode(',',$diwu),'05');
		$diwu_6 = substr_count(implode(',',$diwu),'06');
		$diwu_7 = substr_count(implode(',',$diwu),'07');
		$diwu_8 = substr_count(implode(',',$diwu),'08');
		$diwu_9 = substr_count(implode(',',$diwu),'09');
		$diwu_10 = substr_count(implode(',',$diwu),'10');
		$diwu_11 = substr_count(implode(',',$diwu),'11');
		$this->assign('diwu_1',$diwu_1);
		$this->assign('diwu_2',$diwu_2);
		$this->assign('diwu_3',$diwu_3);
		$this->assign('diwu_4',$diwu_4);
		$this->assign('diwu_5',$diwu_5);
		$this->assign('diwu_6',$diwu_6);
		$this->assign('diwu_7',$diwu_7);
		$this->assign('diwu_8',$diwu_8);
		$this->assign('diwu_9',$diwu_9);
		$this->assign('diwu_10',$diwu_10);
		$this->assign('diwu_11',$diwu_11);

		//分布
		$fenbu_1 = $diyi_1+$dier_1+$disan_1+$disi_1+$diwu_1;
		$fenbu_2 = $diyi_2+$dier_2+$disan_2+$disi_2+$diwu_2;
		$fenbu_3 = $diyi_3+$dier_3+$disan_3+$disi_3+$diwu_3;
		$fenbu_4 = $diyi_4+$dier_4+$disan_4+$disi_4+$diwu_4;
		$fenbu_5 = $diyi_5+$dier_5+$disan_5+$disi_5+$diwu_5;
		$fenbu_6 = $diyi_6+$dier_6+$disan_6+$disi_6+$diwu_6;
		$fenbu_7 = $diyi_7+$dier_7+$disan_7+$disi_7+$diwu_7;
		$fenbu_8 = $diyi_8+$dier_8+$disan_8+$disi_8+$diwu_8;
		$fenbu_9 = $diyi_9+$dier_9+$disan_9+$disi_9+$diwu_9;
		$fenbu_10 = $diyi_10+$dier_10+$disan_10+$disi_10+$diwu_10;
		$fenbu_11 = $diyi_11+$dier_11+$disan_11+$disi_11+$diwu_11;

		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);
		$this->assign('fenbu_10',$fenbu_10);
		$this->assign('fenbu_11',$fenbu_11);



		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$y_1 = intval($zhanshi_qishu/$diyi_1);
		$y_2 = intval($zhanshi_qishu/$diyi_2);
		$y_3 = intval($zhanshi_qishu/$diyi_3);
		$y_4 = intval($zhanshi_qishu/$diyi_4);
		$y_5 = intval($zhanshi_qishu/$diyi_5);
		$y_6 = intval($zhanshi_qishu/$diyi_6);
		$y_7 = intval($zhanshi_qishu/$diyi_7);
		$y_8 = intval($zhanshi_qishu/$diyi_8);
		$y_9 = intval($zhanshi_qishu/$diyi_9);
		$y_10 = intval($zhanshi_qishu/$diyi_10);
		$y_11 = intval($zhanshi_qishu/$diyi_11);
		$this->assign('y_1',$y_1);
		$this->assign('y_2',$y_2);
		$this->assign('y_3',$y_3);
		$this->assign('y_4',$y_4);
		$this->assign('y_5',$y_5);
		$this->assign('y_6',$y_6);
		$this->assign('y_7',$y_7);
		$this->assign('y_8',$y_8);
		$this->assign('y_9',$y_9);
		$this->assign('y_10',$y_10);
		$this->assign('y_11',$y_11);

		$e_1 = intval($zhanshi_qishu/$dier_1);
		$e_2 = intval($zhanshi_qishu/$dier_2);
		$e_3 = intval($zhanshi_qishu/$dier_3);
		$e_4 = intval($zhanshi_qishu/$dier_4);
		$e_5 = intval($zhanshi_qishu/$dier_5);
		$e_6 = intval($zhanshi_qishu/$dier_6);
		$e_7 = intval($zhanshi_qishu/$dier_7);
		$e_8 = intval($zhanshi_qishu/$dier_8);
		$e_9 = intval($zhanshi_qishu/$dier_9);
		$e_10 = intval($zhanshi_qishu/$dier_10);
		$e_11 = intval($zhanshi_qishu/$dier_11);
		$this->assign('e_1',$e_1);
		$this->assign('e_2',$e_2);
		$this->assign('e_3',$e_3);
		$this->assign('e_4',$e_4);
		$this->assign('e_5',$e_5);
		$this->assign('e_6',$e_6);
		$this->assign('e_7',$e_7);
		$this->assign('e_8',$e_8);
		$this->assign('e_9',$e_9);
		$this->assign('e_10',$e_10);
		$this->assign('e_11',$e_11);
		$s_1 = intval($zhanshi_qishu/$disan_1);
		$s_2 = intval($zhanshi_qishu/$disan_2);
		$s_3 = intval($zhanshi_qishu/$disan_3);
		$s_4 = intval($zhanshi_qishu/$disan_4);
		$s_5 = intval($zhanshi_qishu/$disan_5);
		$s_6 = intval($zhanshi_qishu/$disan_6);
		$s_7 = intval($zhanshi_qishu/$disan_7);
		$s_8 = intval($zhanshi_qishu/$disan_8);
		$s_9 = intval($zhanshi_qishu/$disan_9);
		$s_10 = intval($zhanshi_qishu/$disan_10);
		$s_11 = intval($zhanshi_qishu/$disan_11);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);
		$this->assign('s_10',$s_10);
		$this->assign('s_11',$s_11);


		$ss_1 = intval($zhanshi_qishu/$disi_1);
		$ss_2 = intval($zhanshi_qishu/$disi_2);
		$ss_3 = intval($zhanshi_qishu/$disi_3);
		$ss_4 = intval($zhanshi_qishu/$disi_4);
		$ss_5 = intval($zhanshi_qishu/$disi_5);
		$ss_6 = intval($zhanshi_qishu/$disi_6);
		$ss_7 = intval($zhanshi_qishu/$disi_7);
		$ss_8 = intval($zhanshi_qishu/$disi_8);
		$ss_9 = intval($zhanshi_qishu/$disi_9);
		$ss_10 = intval($zhanshi_qishu/$disi_10);
		$ss_11 = intval($zhanshi_qishu/$disi_11);
		$this->assign('ss_1',$ss_1);
		$this->assign('ss_2',$ss_2);
		$this->assign('ss_3',$ss_3);
		$this->assign('ss_4',$ss_4);
		$this->assign('ss_5',$ss_5);
		$this->assign('ss_6',$ss_6);
		$this->assign('ss_7',$ss_7);
		$this->assign('ss_8',$ss_8);
		$this->assign('ss_9',$ss_9);
		$this->assign('ss_10',$ss_10);
		$this->assign('ss_11',$ss_11);

		$w_1 = intval($zhanshi_qishu/$diwu_1);
		$w_2 = intval($zhanshi_qishu/$diwu_2);
		$w_3 = intval($zhanshi_qishu/$diwu_3);
		$w_4 = intval($zhanshi_qishu/$diwu_4);
		$w_5 = intval($zhanshi_qishu/$diwu_5);
		$w_6 = intval($zhanshi_qishu/$diwu_6);
		$w_7 = intval($zhanshi_qishu/$diwu_7);
		$w_8 = intval($zhanshi_qishu/$diwu_8);
		$w_9 = intval($zhanshi_qishu/$diwu_9);
		$w_10 = intval($zhanshi_qishu/$diwu_10);
		$w_11 = intval($zhanshi_qishu/$diwu_11);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);
		$this->assign('w_10',$w_10);
		$this->assign('w_11',$w_11);

		$f_1 = intval($zhanshi_qishu/$fenbu_1);
		$f_2 = intval($zhanshi_qishu/$fenbu_2);
		$f_3 = intval($zhanshi_qishu/$fenbu_3);
		$f_4 = intval($zhanshi_qishu/$fenbu_4);
		$f_5 = intval($zhanshi_qishu/$fenbu_5);
		$f_6 = intval($zhanshi_qishu/$fenbu_6);
		$f_7 = intval($zhanshi_qishu/$fenbu_7);
		$f_8 = intval($zhanshi_qishu/$fenbu_8);
		$f_9 = intval($zhanshi_qishu/$fenbu_9);
		$f_10 = intval($zhanshi_qishu/$fenbu_10);
		$f_11 = intval($zhanshi_qishu/$fenbu_11);
		$this->assign('f_1',$f_1);
		$this->assign('f_2',$f_2);
		$this->assign('f_3',$f_3);
		$this->assign('f_4',$f_4);
		$this->assign('f_5',$f_5);
		$this->assign('f_6',$f_6);
		$this->assign('f_7',$f_7);
		$this->assign('f_8',$f_8);
		$this->assign('f_9',$f_9);
		$this->assign('f_10',$f_10);
		$this->assign('f_11',$f_11);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function shsyx5_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='sh11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='sh11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='sh11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "上海十一选五报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//山东11x5走势图列表
	public function trendChart_sdsyx5(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='sd11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='sd11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='sd11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$diyi[] = $v[0].$v[1];
			$dier[] = $v[3].$v[4];
			$disan[] = $v[6].$v[7];
			$disi[] = $v[9].$v[10];
			$diwu[] = $v[12].$v[13];
		}

		$diyi_1 = substr_count(implode(',',$diyi),'01');
		$diyi_2 = substr_count(implode(',',$diyi),'02');
		$diyi_3 = substr_count(implode(',',$diyi),'03');
		$diyi_4 = substr_count(implode(',',$diyi),'04');
		$diyi_5 = substr_count(implode(',',$diyi),'05');
		$diyi_6 = substr_count(implode(',',$diyi),'06');
		$diyi_7 = substr_count(implode(',',$diyi),'07');
		$diyi_8 = substr_count(implode(',',$diyi),'08');
		$diyi_9 = substr_count(implode(',',$diyi),'09');
		$diyi_10 = substr_count(implode(',',$diyi),'10');
		$diyi_11 = substr_count(implode(',',$diyi),'11');
		$this->assign('diyi_1',$diyi_1);
		$this->assign('diyi_2',$diyi_2);
		$this->assign('diyi_3',$diyi_3);
		$this->assign('diyi_4',$diyi_4);
		$this->assign('diyi_5',$diyi_5);
		$this->assign('diyi_6',$diyi_6);
		$this->assign('diyi_7',$diyi_7);
		$this->assign('diyi_8',$diyi_8);
		$this->assign('diyi_9',$diyi_9);
		$this->assign('diyi_10',$diyi_10);
		$this->assign('diyi_11',$diyi_11);

		$dier_1 = substr_count(implode(',',$dier),'01');
		$dier_2 = substr_count(implode(',',$dier),'02');
		$dier_3 = substr_count(implode(',',$dier),'03');
		$dier_4 = substr_count(implode(',',$dier),'04');
		$dier_5 = substr_count(implode(',',$dier),'05');
		$dier_6 = substr_count(implode(',',$dier),'06');
		$dier_7 = substr_count(implode(',',$dier),'07');
		$dier_8 = substr_count(implode(',',$dier),'08');
		$dier_9 = substr_count(implode(',',$dier),'09');
		$dier_10 = substr_count(implode(',',$dier),'10');
		$dier_11 = substr_count(implode(',',$dier),'11');
		$this->assign('dier_1',$dier_1);
		$this->assign('dier_2',$dier_2);
		$this->assign('dier_3',$dier_3);
		$this->assign('dier_4',$dier_4);
		$this->assign('dier_5',$dier_5);
		$this->assign('dier_6',$dier_6);
		$this->assign('dier_7',$dier_7);
		$this->assign('dier_8',$dier_8);
		$this->assign('dier_9',$dier_9);
		$this->assign('dier_10',$dier_10);
		$this->assign('dier_11',$dier_11);

		$disan_1 = substr_count(implode(',',$disan),'01');
		$disan_2 = substr_count(implode(',',$disan),'02');
		$disan_3 = substr_count(implode(',',$disan),'03');
		$disan_4 = substr_count(implode(',',$disan),'04');
		$disan_5 = substr_count(implode(',',$disan),'05');
		$disan_6 = substr_count(implode(',',$disan),'06');
		$disan_7 = substr_count(implode(',',$disan),'07');
		$disan_8 = substr_count(implode(',',$disan),'08');
		$disan_9 = substr_count(implode(',',$disan),'09');
		$disan_10 = substr_count(implode(',',$disan),'10');
		$disan_11 = substr_count(implode(',',$disan),'11');
		$this->assign('disan_1',$disan_1);
		$this->assign('disan_2',$disan_2);
		$this->assign('disan_3',$disan_3);
		$this->assign('disan_4',$disan_4);
		$this->assign('disan_5',$disan_5);
		$this->assign('disan_6',$disan_6);
		$this->assign('disan_7',$disan_7);
		$this->assign('disan_8',$disan_8);
		$this->assign('disan_9',$disan_9);
		$this->assign('disan_10',$disan_10);
		$this->assign('disan_11',$disan_11);

		$disi_1 = substr_count(implode(',',$disi),'01');
		$disi_2 = substr_count(implode(',',$disi),'02');
		$disi_3 = substr_count(implode(',',$disi),'03');
		$disi_4 = substr_count(implode(',',$disi),'04');
		$disi_5 = substr_count(implode(',',$disi),'05');
		$disi_6 = substr_count(implode(',',$disi),'06');
		$disi_7 = substr_count(implode(',',$disi),'07');
		$disi_8 = substr_count(implode(',',$disi),'08');
		$disi_9 = substr_count(implode(',',$disi),'09');
		$disi_10 = substr_count(implode(',',$disi),'10');
		$disi_11 = substr_count(implode(',',$disi),'11');
		$this->assign('disi_1',$disi_1);
		$this->assign('disi_2',$disi_2);
		$this->assign('disi_3',$disi_3);
		$this->assign('disi_4',$disi_4);
		$this->assign('disi_5',$disi_5);
		$this->assign('disi_6',$disi_6);
		$this->assign('disi_7',$disi_7);
		$this->assign('disi_8',$disi_8);
		$this->assign('disi_9',$disi_9);
		$this->assign('disi_10',$disi_10);
		$this->assign('disi_11',$disi_11);

		$diwu_1 = substr_count(implode(',',$diwu),'01');
		$diwu_2 = substr_count(implode(',',$diwu),'02');
		$diwu_3 = substr_count(implode(',',$diwu),'03');
		$diwu_4 = substr_count(implode(',',$diwu),'04');
		$diwu_5 = substr_count(implode(',',$diwu),'05');
		$diwu_6 = substr_count(implode(',',$diwu),'06');
		$diwu_7 = substr_count(implode(',',$diwu),'07');
		$diwu_8 = substr_count(implode(',',$diwu),'08');
		$diwu_9 = substr_count(implode(',',$diwu),'09');
		$diwu_10 = substr_count(implode(',',$diwu),'10');
		$diwu_11 = substr_count(implode(',',$diwu),'11');
		$this->assign('diwu_1',$diwu_1);
		$this->assign('diwu_2',$diwu_2);
		$this->assign('diwu_3',$diwu_3);
		$this->assign('diwu_4',$diwu_4);
		$this->assign('diwu_5',$diwu_5);
		$this->assign('diwu_6',$diwu_6);
		$this->assign('diwu_7',$diwu_7);
		$this->assign('diwu_8',$diwu_8);
		$this->assign('diwu_9',$diwu_9);
		$this->assign('diwu_10',$diwu_10);
		$this->assign('diwu_11',$diwu_11);

		//分布
		$fenbu_1 = $diyi_1+$dier_1+$disan_1+$disi_1+$diwu_1;
		$fenbu_2 = $diyi_2+$dier_2+$disan_2+$disi_2+$diwu_2;
		$fenbu_3 = $diyi_3+$dier_3+$disan_3+$disi_3+$diwu_3;
		$fenbu_4 = $diyi_4+$dier_4+$disan_4+$disi_4+$diwu_4;
		$fenbu_5 = $diyi_5+$dier_5+$disan_5+$disi_5+$diwu_5;
		$fenbu_6 = $diyi_6+$dier_6+$disan_6+$disi_6+$diwu_6;
		$fenbu_7 = $diyi_7+$dier_7+$disan_7+$disi_7+$diwu_7;
		$fenbu_8 = $diyi_8+$dier_8+$disan_8+$disi_8+$diwu_8;
		$fenbu_9 = $diyi_9+$dier_9+$disan_9+$disi_9+$diwu_9;
		$fenbu_10 = $diyi_10+$dier_10+$disan_10+$disi_10+$diwu_10;
		$fenbu_11 = $diyi_11+$dier_11+$disan_11+$disi_11+$diwu_11;

		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);
		$this->assign('fenbu_10',$fenbu_10);
		$this->assign('fenbu_11',$fenbu_11);



		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$y_1 = intval($zhanshi_qishu/$diyi_1);
		$y_2 = intval($zhanshi_qishu/$diyi_2);
		$y_3 = intval($zhanshi_qishu/$diyi_3);
		$y_4 = intval($zhanshi_qishu/$diyi_4);
		$y_5 = intval($zhanshi_qishu/$diyi_5);
		$y_6 = intval($zhanshi_qishu/$diyi_6);
		$y_7 = intval($zhanshi_qishu/$diyi_7);
		$y_8 = intval($zhanshi_qishu/$diyi_8);
		$y_9 = intval($zhanshi_qishu/$diyi_9);
		$y_10 = intval($zhanshi_qishu/$diyi_10);
		$y_11 = intval($zhanshi_qishu/$diyi_11);
		$this->assign('y_1',$y_1);
		$this->assign('y_2',$y_2);
		$this->assign('y_3',$y_3);
		$this->assign('y_4',$y_4);
		$this->assign('y_5',$y_5);
		$this->assign('y_6',$y_6);
		$this->assign('y_7',$y_7);
		$this->assign('y_8',$y_8);
		$this->assign('y_9',$y_9);
		$this->assign('y_10',$y_10);
		$this->assign('y_11',$y_11);

		$e_1 = intval($zhanshi_qishu/$dier_1);
		$e_2 = intval($zhanshi_qishu/$dier_2);
		$e_3 = intval($zhanshi_qishu/$dier_3);
		$e_4 = intval($zhanshi_qishu/$dier_4);
		$e_5 = intval($zhanshi_qishu/$dier_5);
		$e_6 = intval($zhanshi_qishu/$dier_6);
		$e_7 = intval($zhanshi_qishu/$dier_7);
		$e_8 = intval($zhanshi_qishu/$dier_8);
		$e_9 = intval($zhanshi_qishu/$dier_9);
		$e_10 = intval($zhanshi_qishu/$dier_10);
		$e_11 = intval($zhanshi_qishu/$dier_11);
		$this->assign('e_1',$e_1);
		$this->assign('e_2',$e_2);
		$this->assign('e_3',$e_3);
		$this->assign('e_4',$e_4);
		$this->assign('e_5',$e_5);
		$this->assign('e_6',$e_6);
		$this->assign('e_7',$e_7);
		$this->assign('e_8',$e_8);
		$this->assign('e_9',$e_9);
		$this->assign('e_10',$e_10);
		$this->assign('e_11',$e_11);
		$s_1 = intval($zhanshi_qishu/$disan_1);
		$s_2 = intval($zhanshi_qishu/$disan_2);
		$s_3 = intval($zhanshi_qishu/$disan_3);
		$s_4 = intval($zhanshi_qishu/$disan_4);
		$s_5 = intval($zhanshi_qishu/$disan_5);
		$s_6 = intval($zhanshi_qishu/$disan_6);
		$s_7 = intval($zhanshi_qishu/$disan_7);
		$s_8 = intval($zhanshi_qishu/$disan_8);
		$s_9 = intval($zhanshi_qishu/$disan_9);
		$s_10 = intval($zhanshi_qishu/$disan_10);
		$s_11 = intval($zhanshi_qishu/$disan_11);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);
		$this->assign('s_10',$s_10);
		$this->assign('s_11',$s_11);


		$ss_1 = intval($zhanshi_qishu/$disi_1);
		$ss_2 = intval($zhanshi_qishu/$disi_2);
		$ss_3 = intval($zhanshi_qishu/$disi_3);
		$ss_4 = intval($zhanshi_qishu/$disi_4);
		$ss_5 = intval($zhanshi_qishu/$disi_5);
		$ss_6 = intval($zhanshi_qishu/$disi_6);
		$ss_7 = intval($zhanshi_qishu/$disi_7);
		$ss_8 = intval($zhanshi_qishu/$disi_8);
		$ss_9 = intval($zhanshi_qishu/$disi_9);
		$ss_10 = intval($zhanshi_qishu/$disi_10);
		$ss_11 = intval($zhanshi_qishu/$disi_11);
		$this->assign('ss_1',$ss_1);
		$this->assign('ss_2',$ss_2);
		$this->assign('ss_3',$ss_3);
		$this->assign('ss_4',$ss_4);
		$this->assign('ss_5',$ss_5);
		$this->assign('ss_6',$ss_6);
		$this->assign('ss_7',$ss_7);
		$this->assign('ss_8',$ss_8);
		$this->assign('ss_9',$ss_9);
		$this->assign('ss_10',$ss_10);
		$this->assign('ss_11',$ss_11);

		$w_1 = intval($zhanshi_qishu/$diwu_1);
		$w_2 = intval($zhanshi_qishu/$diwu_2);
		$w_3 = intval($zhanshi_qishu/$diwu_3);
		$w_4 = intval($zhanshi_qishu/$diwu_4);
		$w_5 = intval($zhanshi_qishu/$diwu_5);
		$w_6 = intval($zhanshi_qishu/$diwu_6);
		$w_7 = intval($zhanshi_qishu/$diwu_7);
		$w_8 = intval($zhanshi_qishu/$diwu_8);
		$w_9 = intval($zhanshi_qishu/$diwu_9);
		$w_10 = intval($zhanshi_qishu/$diwu_10);
		$w_11 = intval($zhanshi_qishu/$diwu_11);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);
		$this->assign('w_10',$w_10);
		$this->assign('w_11',$w_11);

		$f_1 = intval($zhanshi_qishu/$fenbu_1);
		$f_2 = intval($zhanshi_qishu/$fenbu_2);
		$f_3 = intval($zhanshi_qishu/$fenbu_3);
		$f_4 = intval($zhanshi_qishu/$fenbu_4);
		$f_5 = intval($zhanshi_qishu/$fenbu_5);
		$f_6 = intval($zhanshi_qishu/$fenbu_6);
		$f_7 = intval($zhanshi_qishu/$fenbu_7);
		$f_8 = intval($zhanshi_qishu/$fenbu_8);
		$f_9 = intval($zhanshi_qishu/$fenbu_9);
		$f_10 = intval($zhanshi_qishu/$fenbu_10);
		$f_11 = intval($zhanshi_qishu/$fenbu_11);
		$this->assign('f_1',$f_1);
		$this->assign('f_2',$f_2);
		$this->assign('f_3',$f_3);
		$this->assign('f_4',$f_4);
		$this->assign('f_5',$f_5);
		$this->assign('f_6',$f_6);
		$this->assign('f_7',$f_7);
		$this->assign('f_8',$f_8);
		$this->assign('f_9',$f_9);
		$this->assign('f_10',$f_10);
		$this->assign('f_11',$f_11);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function sdsyx5_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='sd11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='sd11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='sd11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "山东十一选五报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//江西11x5走势图列表
	public function trendChart_jxsyx5(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='jx11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='jx11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='jx11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);
//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$diyi[] = $v[0].$v[1];
			$dier[] = $v[3].$v[4];
			$disan[] = $v[6].$v[7];
			$disi[] = $v[9].$v[10];
			$diwu[] = $v[12].$v[13];
		}

		$diyi_1 = substr_count(implode(',',$diyi),'01');
		$diyi_2 = substr_count(implode(',',$diyi),'02');
		$diyi_3 = substr_count(implode(',',$diyi),'03');
		$diyi_4 = substr_count(implode(',',$diyi),'04');
		$diyi_5 = substr_count(implode(',',$diyi),'05');
		$diyi_6 = substr_count(implode(',',$diyi),'06');
		$diyi_7 = substr_count(implode(',',$diyi),'07');
		$diyi_8 = substr_count(implode(',',$diyi),'08');
		$diyi_9 = substr_count(implode(',',$diyi),'09');
		$diyi_10 = substr_count(implode(',',$diyi),'10');
		$diyi_11 = substr_count(implode(',',$diyi),'11');
		$this->assign('diyi_1',$diyi_1);
		$this->assign('diyi_2',$diyi_2);
		$this->assign('diyi_3',$diyi_3);
		$this->assign('diyi_4',$diyi_4);
		$this->assign('diyi_5',$diyi_5);
		$this->assign('diyi_6',$diyi_6);
		$this->assign('diyi_7',$diyi_7);
		$this->assign('diyi_8',$diyi_8);
		$this->assign('diyi_9',$diyi_9);
		$this->assign('diyi_10',$diyi_10);
		$this->assign('diyi_11',$diyi_11);

		$dier_1 = substr_count(implode(',',$dier),'01');
		$dier_2 = substr_count(implode(',',$dier),'02');
		$dier_3 = substr_count(implode(',',$dier),'03');
		$dier_4 = substr_count(implode(',',$dier),'04');
		$dier_5 = substr_count(implode(',',$dier),'05');
		$dier_6 = substr_count(implode(',',$dier),'06');
		$dier_7 = substr_count(implode(',',$dier),'07');
		$dier_8 = substr_count(implode(',',$dier),'08');
		$dier_9 = substr_count(implode(',',$dier),'09');
		$dier_10 = substr_count(implode(',',$dier),'10');
		$dier_11 = substr_count(implode(',',$dier),'11');
		$this->assign('dier_1',$dier_1);
		$this->assign('dier_2',$dier_2);
		$this->assign('dier_3',$dier_3);
		$this->assign('dier_4',$dier_4);
		$this->assign('dier_5',$dier_5);
		$this->assign('dier_6',$dier_6);
		$this->assign('dier_7',$dier_7);
		$this->assign('dier_8',$dier_8);
		$this->assign('dier_9',$dier_9);
		$this->assign('dier_10',$dier_10);
		$this->assign('dier_11',$dier_11);

		$disan_1 = substr_count(implode(',',$disan),'01');
		$disan_2 = substr_count(implode(',',$disan),'02');
		$disan_3 = substr_count(implode(',',$disan),'03');
		$disan_4 = substr_count(implode(',',$disan),'04');
		$disan_5 = substr_count(implode(',',$disan),'05');
		$disan_6 = substr_count(implode(',',$disan),'06');
		$disan_7 = substr_count(implode(',',$disan),'07');
		$disan_8 = substr_count(implode(',',$disan),'08');
		$disan_9 = substr_count(implode(',',$disan),'09');
		$disan_10 = substr_count(implode(',',$disan),'10');
		$disan_11 = substr_count(implode(',',$disan),'11');
		$this->assign('disan_1',$disan_1);
		$this->assign('disan_2',$disan_2);
		$this->assign('disan_3',$disan_3);
		$this->assign('disan_4',$disan_4);
		$this->assign('disan_5',$disan_5);
		$this->assign('disan_6',$disan_6);
		$this->assign('disan_7',$disan_7);
		$this->assign('disan_8',$disan_8);
		$this->assign('disan_9',$disan_9);
		$this->assign('disan_10',$disan_10);
		$this->assign('disan_11',$disan_11);

		$disi_1 = substr_count(implode(',',$disi),'01');
		$disi_2 = substr_count(implode(',',$disi),'02');
		$disi_3 = substr_count(implode(',',$disi),'03');
		$disi_4 = substr_count(implode(',',$disi),'04');
		$disi_5 = substr_count(implode(',',$disi),'05');
		$disi_6 = substr_count(implode(',',$disi),'06');
		$disi_7 = substr_count(implode(',',$disi),'07');
		$disi_8 = substr_count(implode(',',$disi),'08');
		$disi_9 = substr_count(implode(',',$disi),'09');
		$disi_10 = substr_count(implode(',',$disi),'10');
		$disi_11 = substr_count(implode(',',$disi),'11');
		$this->assign('disi_1',$disi_1);
		$this->assign('disi_2',$disi_2);
		$this->assign('disi_3',$disi_3);
		$this->assign('disi_4',$disi_4);
		$this->assign('disi_5',$disi_5);
		$this->assign('disi_6',$disi_6);
		$this->assign('disi_7',$disi_7);
		$this->assign('disi_8',$disi_8);
		$this->assign('disi_9',$disi_9);
		$this->assign('disi_10',$disi_10);
		$this->assign('disi_11',$disi_11);

		$diwu_1 = substr_count(implode(',',$diwu),'01');
		$diwu_2 = substr_count(implode(',',$diwu),'02');
		$diwu_3 = substr_count(implode(',',$diwu),'03');
		$diwu_4 = substr_count(implode(',',$diwu),'04');
		$diwu_5 = substr_count(implode(',',$diwu),'05');
		$diwu_6 = substr_count(implode(',',$diwu),'06');
		$diwu_7 = substr_count(implode(',',$diwu),'07');
		$diwu_8 = substr_count(implode(',',$diwu),'08');
		$diwu_9 = substr_count(implode(',',$diwu),'09');
		$diwu_10 = substr_count(implode(',',$diwu),'10');
		$diwu_11 = substr_count(implode(',',$diwu),'11');
		$this->assign('diwu_1',$diwu_1);
		$this->assign('diwu_2',$diwu_2);
		$this->assign('diwu_3',$diwu_3);
		$this->assign('diwu_4',$diwu_4);
		$this->assign('diwu_5',$diwu_5);
		$this->assign('diwu_6',$diwu_6);
		$this->assign('diwu_7',$diwu_7);
		$this->assign('diwu_8',$diwu_8);
		$this->assign('diwu_9',$diwu_9);
		$this->assign('diwu_10',$diwu_10);
		$this->assign('diwu_11',$diwu_11);

		//分布
		$fenbu_1 = $diyi_1+$dier_1+$disan_1+$disi_1+$diwu_1;
		$fenbu_2 = $diyi_2+$dier_2+$disan_2+$disi_2+$diwu_2;
		$fenbu_3 = $diyi_3+$dier_3+$disan_3+$disi_3+$diwu_3;
		$fenbu_4 = $diyi_4+$dier_4+$disan_4+$disi_4+$diwu_4;
		$fenbu_5 = $diyi_5+$dier_5+$disan_5+$disi_5+$diwu_5;
		$fenbu_6 = $diyi_6+$dier_6+$disan_6+$disi_6+$diwu_6;
		$fenbu_7 = $diyi_7+$dier_7+$disan_7+$disi_7+$diwu_7;
		$fenbu_8 = $diyi_8+$dier_8+$disan_8+$disi_8+$diwu_8;
		$fenbu_9 = $diyi_9+$dier_9+$disan_9+$disi_9+$diwu_9;
		$fenbu_10 = $diyi_10+$dier_10+$disan_10+$disi_10+$diwu_10;
		$fenbu_11 = $diyi_11+$dier_11+$disan_11+$disi_11+$diwu_11;

		$this->assign('fenbu_1',$fenbu_1);
		$this->assign('fenbu_2',$fenbu_2);
		$this->assign('fenbu_3',$fenbu_3);
		$this->assign('fenbu_4',$fenbu_4);
		$this->assign('fenbu_5',$fenbu_5);
		$this->assign('fenbu_6',$fenbu_6);
		$this->assign('fenbu_7',$fenbu_7);
		$this->assign('fenbu_8',$fenbu_8);
		$this->assign('fenbu_9',$fenbu_9);
		$this->assign('fenbu_10',$fenbu_10);
		$this->assign('fenbu_11',$fenbu_11);



		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);

//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$y_1 = intval($zhanshi_qishu/$diyi_1);
		$y_2 = intval($zhanshi_qishu/$diyi_2);
		$y_3 = intval($zhanshi_qishu/$diyi_3);
		$y_4 = intval($zhanshi_qishu/$diyi_4);
		$y_5 = intval($zhanshi_qishu/$diyi_5);
		$y_6 = intval($zhanshi_qishu/$diyi_6);
		$y_7 = intval($zhanshi_qishu/$diyi_7);
		$y_8 = intval($zhanshi_qishu/$diyi_8);
		$y_9 = intval($zhanshi_qishu/$diyi_9);
		$y_10 = intval($zhanshi_qishu/$diyi_10);
		$y_11 = intval($zhanshi_qishu/$diyi_11);
		$this->assign('y_1',$y_1);
		$this->assign('y_2',$y_2);
		$this->assign('y_3',$y_3);
		$this->assign('y_4',$y_4);
		$this->assign('y_5',$y_5);
		$this->assign('y_6',$y_6);
		$this->assign('y_7',$y_7);
		$this->assign('y_8',$y_8);
		$this->assign('y_9',$y_9);
		$this->assign('y_10',$y_10);
		$this->assign('y_11',$y_11);

		$e_1 = intval($zhanshi_qishu/$dier_1);
		$e_2 = intval($zhanshi_qishu/$dier_2);
		$e_3 = intval($zhanshi_qishu/$dier_3);
		$e_4 = intval($zhanshi_qishu/$dier_4);
		$e_5 = intval($zhanshi_qishu/$dier_5);
		$e_6 = intval($zhanshi_qishu/$dier_6);
		$e_7 = intval($zhanshi_qishu/$dier_7);
		$e_8 = intval($zhanshi_qishu/$dier_8);
		$e_9 = intval($zhanshi_qishu/$dier_9);
		$e_10 = intval($zhanshi_qishu/$dier_10);
		$e_11 = intval($zhanshi_qishu/$dier_11);
		$this->assign('e_1',$e_1);
		$this->assign('e_2',$e_2);
		$this->assign('e_3',$e_3);
		$this->assign('e_4',$e_4);
		$this->assign('e_5',$e_5);
		$this->assign('e_6',$e_6);
		$this->assign('e_7',$e_7);
		$this->assign('e_8',$e_8);
		$this->assign('e_9',$e_9);
		$this->assign('e_10',$e_10);
		$this->assign('e_11',$e_11);
		$s_1 = intval($zhanshi_qishu/$disan_1);
		$s_2 = intval($zhanshi_qishu/$disan_2);
		$s_3 = intval($zhanshi_qishu/$disan_3);
		$s_4 = intval($zhanshi_qishu/$disan_4);
		$s_5 = intval($zhanshi_qishu/$disan_5);
		$s_6 = intval($zhanshi_qishu/$disan_6);
		$s_7 = intval($zhanshi_qishu/$disan_7);
		$s_8 = intval($zhanshi_qishu/$disan_8);
		$s_9 = intval($zhanshi_qishu/$disan_9);
		$s_10 = intval($zhanshi_qishu/$disan_10);
		$s_11 = intval($zhanshi_qishu/$disan_11);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);
		$this->assign('s_10',$s_10);
		$this->assign('s_11',$s_11);


		$ss_1 = intval($zhanshi_qishu/$disi_1);
		$ss_2 = intval($zhanshi_qishu/$disi_2);
		$ss_3 = intval($zhanshi_qishu/$disi_3);
		$ss_4 = intval($zhanshi_qishu/$disi_4);
		$ss_5 = intval($zhanshi_qishu/$disi_5);
		$ss_6 = intval($zhanshi_qishu/$disi_6);
		$ss_7 = intval($zhanshi_qishu/$disi_7);
		$ss_8 = intval($zhanshi_qishu/$disi_8);
		$ss_9 = intval($zhanshi_qishu/$disi_9);
		$ss_10 = intval($zhanshi_qishu/$disi_10);
		$ss_11 = intval($zhanshi_qishu/$disi_11);
		$this->assign('ss_1',$ss_1);
		$this->assign('ss_2',$ss_2);
		$this->assign('ss_3',$ss_3);
		$this->assign('ss_4',$ss_4);
		$this->assign('ss_5',$ss_5);
		$this->assign('ss_6',$ss_6);
		$this->assign('ss_7',$ss_7);
		$this->assign('ss_8',$ss_8);
		$this->assign('ss_9',$ss_9);
		$this->assign('ss_10',$ss_10);
		$this->assign('ss_11',$ss_11);

		$w_1 = intval($zhanshi_qishu/$diwu_1);
		$w_2 = intval($zhanshi_qishu/$diwu_2);
		$w_3 = intval($zhanshi_qishu/$diwu_3);
		$w_4 = intval($zhanshi_qishu/$diwu_4);
		$w_5 = intval($zhanshi_qishu/$diwu_5);
		$w_6 = intval($zhanshi_qishu/$diwu_6);
		$w_7 = intval($zhanshi_qishu/$diwu_7);
		$w_8 = intval($zhanshi_qishu/$diwu_8);
		$w_9 = intval($zhanshi_qishu/$diwu_9);
		$w_10 = intval($zhanshi_qishu/$diwu_10);
		$w_11 = intval($zhanshi_qishu/$diwu_11);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);
		$this->assign('w_10',$w_10);
		$this->assign('w_11',$w_11);

		$f_1 = intval($zhanshi_qishu/$fenbu_1);
		$f_2 = intval($zhanshi_qishu/$fenbu_2);
		$f_3 = intval($zhanshi_qishu/$fenbu_3);
		$f_4 = intval($zhanshi_qishu/$fenbu_4);
		$f_5 = intval($zhanshi_qishu/$fenbu_5);
		$f_6 = intval($zhanshi_qishu/$fenbu_6);
		$f_7 = intval($zhanshi_qishu/$fenbu_7);
		$f_8 = intval($zhanshi_qishu/$fenbu_8);
		$f_9 = intval($zhanshi_qishu/$fenbu_9);
		$f_10 = intval($zhanshi_qishu/$fenbu_10);
		$f_11 = intval($zhanshi_qishu/$fenbu_11);
		$this->assign('f_1',$f_1);
		$this->assign('f_2',$f_2);
		$this->assign('f_3',$f_3);
		$this->assign('f_4',$f_4);
		$this->assign('f_5',$f_5);
		$this->assign('f_6',$f_6);
		$this->assign('f_7',$f_7);
		$this->assign('f_8',$f_8);
		$this->assign('f_9',$f_9);
		$this->assign('f_10',$f_10);
		$this->assign('f_11',$f_11);

		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function jxsyx5_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='jx11x5'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='jx11x5'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='jx11x5'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "江西十一选五报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}

	//北京快乐8
	public function trendChart_kl8()
	{
		$qishu = I("qishu");
		if ($qishu == "") {
			$qishu = 1;
		}
		if ($qishu == "1") {
			$zoushitu = M("zoushitu")->where("code='bjkl8'")->order("issue desc")->limit(30)->select();
		} elseif ($qishu == "2") {
			$zoushitu = M("zoushitu")->where("code='bjkl8'")->order("issue desc")->limit(50)->select();
		} elseif ($qishu == "3") {
			$zoushitu = M("zoushitu")->where("code='bjkl8'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function kl8_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='bjkl8'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='bjkl8'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='bjkl8'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "北京快乐8报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//北京PK10
	public function trendChart_pk10()
	{
		$qishu = I("qishu");
		if ($qishu == "") {
			$qishu = 1;
		}
		if ($qishu == "1") {
			$zoushitu = M("zoushitu")->where("code='bjpk10'")->order("issue desc")->limit(30)->select();
		} elseif ($qishu == "2") {
			$zoushitu = M("zoushitu")->where("code='bjpk10'")->order("issue desc")->limit(50)->select();
		} elseif ($qishu == "3") {
			$zoushitu = M("zoushitu")->where("code='bjpk10'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function pk10_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='bjpk10'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='bjpk10'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='bjpk10'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "北京PK10报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
	//福彩3d
	public function trendChart_fc3d()
	{
		$qishu = I("qishu");
		if ($qishu == "") {
			$qishu = 1;
		}
		if ($qishu == "1") {
			$zoushitu = M("zoushitu")->where("code='fc3d'")->order("issue desc")->limit(30)->select();
		} elseif ($qishu == "2") {
			$zoushitu = M("zoushitu")->where("code='fc3d'")->order("issue desc")->limit(50)->select();
		} elseif ($qishu == "3") {
			$zoushitu = M("zoushitu")->where("code='fc3d'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);



		//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$w[] = $v[0];
			$q[] = $v[2];
			$b[] = $v[4];
		}

		foreach($aa as $v){
			$ass[]= explode(',',$v);
		}

		foreach($ass as $v){
			$arrs[] = max($v)-min($v);

		}
		$qq = implode(',',$arrs);
		$this->assign("qq",$qq);


		$wan_0 = substr_count(implode(',',$w),'0');
		$wan_1 = substr_count(implode(',',$w),'1');
		$wan_2 = substr_count(implode(',',$w),'2');
		$wan_3 = substr_count(implode(',',$w),'3');
		$wan_4 = substr_count(implode(',',$w),'4');
		$wan_5 = substr_count(implode(',',$w),'5');
		$wan_6 = substr_count(implode(',',$w),'6');
		$wan_7 = substr_count(implode(',',$w),'7');
		$wan_8 = substr_count(implode(',',$w),'8');
		$wan_9 = substr_count(implode(',',$w),'9');

		$qian_0 = substr_count(implode(',',$q),'0');
		$qian_1 = substr_count(implode(',',$q),'1');
		$qian_2 = substr_count(implode(',',$q),'2');
		$qian_3 = substr_count(implode(',',$q),'3');
		$qian_4 = substr_count(implode(',',$q),'4');
		$qian_5 = substr_count(implode(',',$q),'5');
		$qian_6 = substr_count(implode(',',$q),'6');
		$qian_7 = substr_count(implode(',',$q),'7');
		$qian_8 = substr_count(implode(',',$q),'8');
		$qian_9 = substr_count(implode(',',$q),'9');

		$bai_0 = substr_count(implode(',',$b),'0');
		$bai_1 = substr_count(implode(',',$b),'1');
		$bai_2 = substr_count(implode(',',$b),'2');
		$bai_3 = substr_count(implode(',',$b),'3');
		$bai_4 = substr_count(implode(',',$b),'4');
		$bai_5 = substr_count(implode(',',$b),'5');
		$bai_6 = substr_count(implode(',',$b),'6');
		$bai_7 = substr_count(implode(',',$b),'7');
		$bai_8 = substr_count(implode(',',$b),'8');
		$bai_9 = substr_count(implode(',',$b),'9');

		$fenbu_04 = $wan_0+$qian_0+$bai_0;
		$fenbu_14 = $wan_1+$qian_1+$bai_1;
		$fenbu_24 = $wan_2+$qian_2+$bai_2;
		$fenbu_34 = $wan_3+$qian_3+$bai_3;
		$fenbu_44 = $wan_4+$qian_4+$bai_4;
		$fenbu_54 = $wan_5+$qian_5+$bai_5;
		$fenbu_64 = $wan_6+$qian_6+$bai_6;
		$fenbu_74 = $wan_7+$qian_7+$bai_7;
		$fenbu_84 = $wan_8+$qian_8+$bai_8;
		$fenbu_94 = $wan_9+$qian_9+$bai_9;

		$this->assign('fenbu_04',$fenbu_04);
		$this->assign('fenbu_14',$fenbu_14);
		$this->assign('fenbu_24',$fenbu_24);
		$this->assign('fenbu_34',$fenbu_34);
		$this->assign('fenbu_44',$fenbu_44);
		$this->assign('fenbu_54',$fenbu_54);
		$this->assign('fenbu_64',$fenbu_64);
		$this->assign('fenbu_74',$fenbu_74);
		$this->assign('fenbu_84',$fenbu_84);
		$this->assign('fenbu_94',$fenbu_94);

		$this->assign('wan_9',$wan_9);
		$this->assign('wan_8',$wan_8);
		$this->assign('wan_7',$wan_7);
		$this->assign('wan_6',$wan_6);
		$this->assign('wan_5',$wan_5);
		$this->assign('wan_4',$wan_4);
		$this->assign('wan_3',$wan_3);
		$this->assign('wan_2',$wan_2);
		$this->assign('wan_1',$wan_1);
		$this->assign('wan_0',$wan_0);

		$this->assign('qian_0',$qian_0);
		$this->assign('qian_1',$qian_1);
		$this->assign('qian_2',$qian_2);
		$this->assign('qian_3',$qian_3);
		$this->assign('qian_4',$qian_4);
		$this->assign('qian_5',$qian_5);
		$this->assign('qian_6',$qian_6);
		$this->assign('qian_7',$qian_7);
		$this->assign('qian_8',$qian_8);
		$this->assign('qian_9',$qian_9);

		$this->assign('bai_0',$bai_0);
		$this->assign('bai_1',$bai_1);
		$this->assign('bai_2',$bai_2);
		$this->assign('bai_3',$bai_3);
		$this->assign('bai_4',$bai_4);
		$this->assign('bai_5',$bai_5);
		$this->assign('bai_6',$bai_6);
		$this->assign('bai_7',$bai_7);
		$this->assign('bai_8',$bai_8);
		$this->assign('bai_9',$bai_9);


		//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);

		$w_0 = intval($zhanshi_qishu/$wan_0);
		$w_1 = intval($zhanshi_qishu/$wan_1);
		$w_2 = intval($zhanshi_qishu/$wan_2);
		$w_3 = intval($zhanshi_qishu/$wan_3);
		$w_4 = intval($zhanshi_qishu/$wan_4);
		$w_5 = intval($zhanshi_qishu/$wan_5);
		$w_6 = intval($zhanshi_qishu/$wan_6);
		$w_7 = intval($zhanshi_qishu/$wan_7);
		$w_8 = intval($zhanshi_qishu/$wan_8);
		$w_9 = intval($zhanshi_qishu/$wan_9);
		$this->assign('w_0',$w_0);
		$this->assign('w_1',$w_1);
		$this->assign('w_2',$w_2);
		$this->assign('w_3',$w_3);
		$this->assign('w_4',$w_4);
		$this->assign('w_5',$w_5);
		$this->assign('w_6',$w_6);
		$this->assign('w_7',$w_7);
		$this->assign('w_8',$w_8);
		$this->assign('w_9',$w_9);

		$q_0 = intval($zhanshi_qishu/$qian_0);
		$q_1 = intval($zhanshi_qishu/$qian_1);
		$q_2 = intval($zhanshi_qishu/$qian_2);
		$q_3 = intval($zhanshi_qishu/$qian_3);
		$q_4 = intval($zhanshi_qishu/$qian_4);
		$q_5 = intval($zhanshi_qishu/$qian_5);
		$q_6 = intval($zhanshi_qishu/$qian_6);
		$q_7 = intval($zhanshi_qishu/$qian_7);
		$q_8 = intval($zhanshi_qishu/$qian_8);
		$q_9 = intval($zhanshi_qishu/$qian_9);
		$this->assign('q_0',$q_0);
		$this->assign('q_1',$q_1);
		$this->assign('q_2',$q_2);
		$this->assign('q_3',$q_3);
		$this->assign('q_4',$q_4);
		$this->assign('q_5',$q_5);
		$this->assign('q_6',$q_6);
		$this->assign('q_7',$q_7);
		$this->assign('q_8',$q_8);
		$this->assign('q_9',$q_9);

		$b_0 = intval($zhanshi_qishu/$bai_0);
		$b_1 = intval($zhanshi_qishu/$bai_1);
		$b_2 = intval($zhanshi_qishu/$bai_2);
		$b_3 = intval($zhanshi_qishu/$bai_3);
		$b_4 = intval($zhanshi_qishu/$bai_4);
		$b_5 = intval($zhanshi_qishu/$bai_5);
		$b_6 = intval($zhanshi_qishu/$bai_6);
		$b_7 = intval($zhanshi_qishu/$bai_7);
		$b_8 = intval($zhanshi_qishu/$bai_8);
		$b_9 = intval($zhanshi_qishu/$bai_9);
		$this->assign('b_0',$b_0);
		$this->assign('b_1',$b_1);
		$this->assign('b_2',$b_2);
		$this->assign('b_3',$b_3);
		$this->assign('b_4',$b_4);
		$this->assign('b_5',$b_5);
		$this->assign('b_6',$b_6);
		$this->assign('b_7',$b_7);
		$this->assign('b_8',$b_8);
		$this->assign('b_9',$b_9);

		$fen_04 = intval($zhanshi_qishu/$fenbu_04);
		$fen_14 = intval($zhanshi_qishu/$fenbu_14);
		$fen_24 = intval($zhanshi_qishu/$fenbu_24);
		$fen_34 = intval($zhanshi_qishu/$fenbu_34);
		$fen_44 = intval($zhanshi_qishu/$fenbu_44);
		$fen_54 = intval($zhanshi_qishu/$fenbu_54);
		$fen_64 = intval($zhanshi_qishu/$fenbu_64);
		$fen_74 = intval($zhanshi_qishu/$fenbu_74);
		$fen_84 = intval($zhanshi_qishu/$fenbu_84);
		$fen_94 = intval($zhanshi_qishu/$fenbu_94);
		$this->assign('fen_04',$fen_04);
		$this->assign('fen_14',$fen_14);
		$this->assign('fen_24',$fen_24);
		$this->assign('fen_34',$fen_34);
		$this->assign('fen_44',$fen_44);
		$this->assign('fen_54',$fen_54);
		$this->assign('fen_64',$fen_64);
		$this->assign('fen_74',$fen_74);
		$this->assign('fen_84',$fen_84);
		$this->assign('fen_94',$fen_94);

		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('qishu',$qishu);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function fc3d_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='fc3d'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='fc3d'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='fc3d'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();

		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "福彩3D报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}

	//排列3走势图列表
	public function trendChart_pl3(){
		$qishu = I("qishu");
		$maifa = I("maifa");
		if($maifa==""){
			$maifa=1;
		}
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='pl3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='pl3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='pl3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);


		//出现总次数
		foreach($zoushitu as $v){
			$aa[] = trim($v['opencode']);
		}

		foreach($aa as $v){
			$b[] = $v[0];
			$s[] = $v[2];
			$g[] = $v[4];
		}

		foreach($aa as $v){
			$ass[]= explode(',',$v);
		}

		foreach($ass as $v){
			$arrs[] = max($v)-min($v);

		}
		$qq = implode(',',$arrs);
		$this->assign("qq",$qq);

		//号码跨度
		$kua_0 = substr_count($qq,'0');
		$kua_1 = substr_count($qq,'1');
		$kua_2 = substr_count($qq,'2');
		$kua_3 = substr_count($qq,'3');
		$kua_4 = substr_count($qq,'4');
		$kua_5 = substr_count($qq,'5');
		$kua_6 = substr_count($qq,'6');
		$kua_7 = substr_count($qq,'7');
		$kua_8 = substr_count($qq,'8');
		$kua_9 = substr_count($qq,'9');


		$bai_0 = substr_count(implode(',',$b),'0');
		$bai_1 = substr_count(implode(',',$b),'1');
		$bai_2 = substr_count(implode(',',$b),'2');
		$bai_3 = substr_count(implode(',',$b),'3');
		$bai_4 = substr_count(implode(',',$b),'4');
		$bai_5 = substr_count(implode(',',$b),'5');
		$bai_6 = substr_count(implode(',',$b),'6');
		$bai_7 = substr_count(implode(',',$b),'7');
		$bai_8 = substr_count(implode(',',$b),'8');
		$bai_9 = substr_count(implode(',',$b),'9');

		$shi_0 = substr_count(implode(',',$s),'0');
		$shi_1 = substr_count(implode(',',$s),'1');
		$shi_2 = substr_count(implode(',',$s),'2');
		$shi_3 = substr_count(implode(',',$s),'3');
		$shi_4 = substr_count(implode(',',$s),'4');
		$shi_5 = substr_count(implode(',',$s),'5');
		$shi_6 = substr_count(implode(',',$s),'6');
		$shi_7 = substr_count(implode(',',$s),'7');
		$shi_8 = substr_count(implode(',',$s),'8');
		$shi_9 = substr_count(implode(',',$s),'9');

		$ge_0 = substr_count(implode(',',$g),'0');
		$ge_1 = substr_count(implode(',',$g),'1');
		$ge_2 = substr_count(implode(',',$g),'2');
		$ge_3 = substr_count(implode(',',$g),'3');
		$ge_4 = substr_count(implode(',',$g),'4');
		$ge_5 = substr_count(implode(',',$g),'5');
		$ge_6 = substr_count(implode(',',$g),'6');
		$ge_7 = substr_count(implode(',',$g),'7');
		$ge_8 = substr_count(implode(',',$g),'8');
		$ge_9 = substr_count(implode(',',$g),'9');


		$fenbu_06 = $bai_0+$shi_0+$ge_0;
		$fenbu_16 = $bai_1+$shi_1+$ge_1;
		$fenbu_26 = $bai_2+$shi_2+$ge_2;
		$fenbu_36 = $bai_3+$shi_3+$ge_3;
		$fenbu_46 = $bai_4+$shi_4+$ge_4;
		$fenbu_56 = $bai_5+$shi_5+$ge_5;
		$fenbu_66 = $bai_6+$shi_6+$ge_6;
		$fenbu_76 = $bai_7+$shi_7+$ge_7;
		$fenbu_86 = $bai_8+$shi_8+$ge_8;
		$fenbu_96 = $bai_9+$shi_9+$ge_9;

		$this->assign('fenbu_06',$fenbu_06);
		$this->assign('fenbu_16',$fenbu_16);
		$this->assign('fenbu_26',$fenbu_26);
		$this->assign('fenbu_36',$fenbu_36);
		$this->assign('fenbu_46',$fenbu_46);
		$this->assign('fenbu_56',$fenbu_56);
		$this->assign('fenbu_66',$fenbu_66);
		$this->assign('fenbu_76',$fenbu_76);
		$this->assign('fenbu_86',$fenbu_86);
		$this->assign('fenbu_96',$fenbu_96);

		$fenbu_07 = $bai_0+$shi_0;
		$fenbu_17 = $bai_1+$shi_1;
		$fenbu_27 = $bai_2+$shi_2;
		$fenbu_37 = $bai_3+$shi_3;
		$fenbu_47 = $bai_4+$shi_4;
		$fenbu_57 = $bai_5+$shi_5;
		$fenbu_67 = $bai_6+$shi_6;
		$fenbu_77 = $bai_7+$shi_7;
		$fenbu_87 = $bai_8+$shi_8;
		$fenbu_97 = $bai_9+$shi_9;

		$this->assign('fenbu_07',$fenbu_07);
		$this->assign('fenbu_17',$fenbu_17);
		$this->assign('fenbu_27',$fenbu_27);
		$this->assign('fenbu_37',$fenbu_37);
		$this->assign('fenbu_47',$fenbu_47);
		$this->assign('fenbu_57',$fenbu_57);
		$this->assign('fenbu_67',$fenbu_67);
		$this->assign('fenbu_77',$fenbu_77);
		$this->assign('fenbu_87',$fenbu_87);
		$this->assign('fenbu_97',$fenbu_97);

		$fenbu_00 = $shi_0+$ge_0;
		$fenbu_10 = $shi_1+$ge_1;
		$fenbu_20 = $shi_2+$ge_2;
		$fenbu_30 = $shi_3+$ge_3;
		$fenbu_40 = $shi_4+$ge_4;
		$fenbu_50 = $shi_5+$ge_5;
		$fenbu_60 = $shi_6+$ge_6;
		$fenbu_70 = $shi_7+$ge_7;
		$fenbu_80 = $shi_8+$ge_8;
		$fenbu_90 = $shi_9+$ge_9;

		$this->assign('fenbu_00',$fenbu_00);
		$this->assign('fenbu_10',$fenbu_10);
		$this->assign('fenbu_20',$fenbu_20);
		$this->assign('fenbu_30',$fenbu_30);
		$this->assign('fenbu_40',$fenbu_40);
		$this->assign('fenbu_50',$fenbu_50);
		$this->assign('fenbu_60',$fenbu_60);
		$this->assign('fenbu_70',$fenbu_70);
		$this->assign('fenbu_80',$fenbu_80);
		$this->assign('fenbu_90',$fenbu_90);


		$this->assign('bai_0',$bai_0);
		$this->assign('bai_1',$bai_1);
		$this->assign('bai_2',$bai_2);
		$this->assign('bai_3',$bai_3);
		$this->assign('bai_4',$bai_4);
		$this->assign('bai_5',$bai_5);
		$this->assign('bai_6',$bai_6);
		$this->assign('bai_7',$bai_7);
		$this->assign('bai_8',$bai_8);
		$this->assign('bai_9',$bai_9);

		$this->assign('shi_0',$shi_0);
		$this->assign('shi_1',$shi_1);
		$this->assign('shi_2',$shi_2);
		$this->assign('shi_3',$shi_3);
		$this->assign('shi_4',$shi_4);
		$this->assign('shi_5',$shi_5);
		$this->assign('shi_6',$shi_6);
		$this->assign('shi_7',$shi_7);
		$this->assign('shi_8',$shi_8);
		$this->assign('shi_9',$shi_9);

		$this->assign('ge_0',$ge_0);
		$this->assign('ge_1',$ge_1);
		$this->assign('ge_2',$ge_2);
		$this->assign('ge_3',$ge_3);
		$this->assign('ge_4',$ge_4);
		$this->assign('ge_5',$ge_5);
		$this->assign('ge_6',$ge_6);
		$this->assign('ge_7',$ge_7);
		$this->assign('ge_8',$ge_8);
		$this->assign('ge_9',$ge_9);

		//平均遗漏值

		$zhanshi_qishu = count($zoushitu);
		$this->assign("zhanshi_qishu",$zhanshi_qishu);


		$b_0 = intval($zhanshi_qishu/$bai_0);
		$b_1 = intval($zhanshi_qishu/$bai_1);
		$b_2 = intval($zhanshi_qishu/$bai_2);
		$b_3 = intval($zhanshi_qishu/$bai_3);
		$b_4 = intval($zhanshi_qishu/$bai_4);
		$b_5 = intval($zhanshi_qishu/$bai_5);
		$b_6 = intval($zhanshi_qishu/$bai_6);
		$b_7 = intval($zhanshi_qishu/$bai_7);
		$b_8 = intval($zhanshi_qishu/$bai_8);
		$b_9 = intval($zhanshi_qishu/$bai_9);
		$this->assign('b_0',$b_0);
		$this->assign('b_1',$b_1);
		$this->assign('b_2',$b_2);
		$this->assign('b_3',$b_3);
		$this->assign('b_4',$b_4);
		$this->assign('b_5',$b_5);
		$this->assign('b_6',$b_6);
		$this->assign('b_7',$b_7);
		$this->assign('b_8',$b_8);
		$this->assign('b_9',$b_9);

		$s_0 = intval($zhanshi_qishu/$shi_0);
		$s_1 = intval($zhanshi_qishu/$shi_1);
		$s_2 = intval($zhanshi_qishu/$shi_2);
		$s_3 = intval($zhanshi_qishu/$shi_3);
		$s_4 = intval($zhanshi_qishu/$shi_4);
		$s_5 = intval($zhanshi_qishu/$shi_5);
		$s_6 = intval($zhanshi_qishu/$shi_6);
		$s_7 = intval($zhanshi_qishu/$shi_7);
		$s_8 = intval($zhanshi_qishu/$shi_8);
		$s_9 = intval($zhanshi_qishu/$shi_9);
		$this->assign('s_0',$s_0);
		$this->assign('s_1',$s_1);
		$this->assign('s_2',$s_2);
		$this->assign('s_3',$s_3);
		$this->assign('s_4',$s_4);
		$this->assign('s_5',$s_5);
		$this->assign('s_6',$s_6);
		$this->assign('s_7',$s_7);
		$this->assign('s_8',$s_8);
		$this->assign('s_9',$s_9);

		$g_0 = intval($zhanshi_qishu/$ge_0);
		$g_1 = intval($zhanshi_qishu/$ge_1);
		$g_2 = intval($zhanshi_qishu/$ge_2);
		$g_3 = intval($zhanshi_qishu/$ge_3);
		$g_4 = intval($zhanshi_qishu/$ge_4);
		$g_5 = intval($zhanshi_qishu/$ge_5);
		$g_6 = intval($zhanshi_qishu/$ge_6);
		$g_7 = intval($zhanshi_qishu/$ge_7);
		$g_8 = intval($zhanshi_qishu/$ge_8);
		$g_9 = intval($zhanshi_qishu/$ge_9);
		$this->assign('g_0',$g_0);
		$this->assign('g_1',$g_1);
		$this->assign('g_2',$g_2);
		$this->assign('g_3',$g_3);
		$this->assign('g_4',$g_4);
		$this->assign('g_5',$g_5);
		$this->assign('g_6',$g_6);
		$this->assign('g_7',$g_7);
		$this->assign('g_8',$g_8);
		$this->assign('g_9',$g_9);

		$fen_06 = intval($zhanshi_qishu/$fenbu_06);
		$fen_16 = intval($zhanshi_qishu/$fenbu_16);
		$fen_26 = intval($zhanshi_qishu/$fenbu_26);
		$fen_36 = intval($zhanshi_qishu/$fenbu_36);
		$fen_46 = intval($zhanshi_qishu/$fenbu_46);
		$fen_56 = intval($zhanshi_qishu/$fenbu_56);
		$fen_66 = intval($zhanshi_qishu/$fenbu_66);
		$fen_76 = intval($zhanshi_qishu/$fenbu_76);
		$fen_86 = intval($zhanshi_qishu/$fenbu_86);
		$fen_96 = intval($zhanshi_qishu/$fenbu_96);
		$this->assign('fen_06',$fen_06);
		$this->assign('fen_16',$fen_16);
		$this->assign('fen_26',$fen_26);
		$this->assign('fen_36',$fen_36);
		$this->assign('fen_46',$fen_46);
		$this->assign('fen_56',$fen_56);
		$this->assign('fen_66',$fen_66);
		$this->assign('fen_76',$fen_76);
		$this->assign('fen_86',$fen_86);
		$this->assign('fen_96',$fen_96);

		$fen_07 = intval($zhanshi_qishu/$fenbu_07);
		$fen_17 = intval($zhanshi_qishu/$fenbu_17);
		$fen_27 = intval($zhanshi_qishu/$fenbu_27);
		$fen_37 = intval($zhanshi_qishu/$fenbu_37);
		$fen_47 = intval($zhanshi_qishu/$fenbu_47);
		$fen_57 = intval($zhanshi_qishu/$fenbu_57);
		$fen_67= intval($zhanshi_qishu/$fenbu_67);
		$fen_77 = intval($zhanshi_qishu/$fenbu_77);
		$fen_87 = intval($zhanshi_qishu/$fenbu_87);
		$fen_97 = intval($zhanshi_qishu/$fenbu_97);
		$this->assign('fen_07',$fen_07);
		$this->assign('fen_17',$fen_17);
		$this->assign('fen_27',$fen_27);
		$this->assign('fen_37',$fen_37);
		$this->assign('fen_47',$fen_47);
		$this->assign('fen_57',$fen_57);
		$this->assign('fen_67',$fen_67);
		$this->assign('fen_77',$fen_77);
		$this->assign('fen_87',$fen_87);
		$this->assign('fen_97',$fen_97);

		$fen_09 = intval($zhanshi_qishu/$fenbu_00);
		$fen_19 = intval($zhanshi_qishu/$fenbu_10);
		$fen_29 = intval($zhanshi_qishu/$fenbu_20);
		$fen_39 = intval($zhanshi_qishu/$fenbu_30);
		$fen_49 = intval($zhanshi_qishu/$fenbu_40);
		$fen_59 = intval($zhanshi_qishu/$fenbu_50);
		$fen_69= intval($zhanshi_qishu/$fenbu_60);
		$fen_79 = intval($zhanshi_qishu/$fenbu_70);
		$fen_89 = intval($zhanshi_qishu/$fenbu_80);
		$fen_99 = intval($zhanshi_qishu/$fenbu_90);
		$this->assign('fen_09',$fen_09);
		$this->assign('fen_19',$fen_19);
		$this->assign('fen_29',$fen_29);
		$this->assign('fen_39',$fen_39);
		$this->assign('fen_49',$fen_49);
		$this->assign('fen_59',$fen_59);
		$this->assign('fen_69',$fen_69);
		$this->assign('fen_79',$fen_79);
		$this->assign('fen_89',$fen_89);
		$this->assign('fen_99',$fen_99);

		$ku_0 = intval($zhanshi_qishu/$kua_0);
		$ku_1 = intval($zhanshi_qishu/$kua_1);
		$ku_2 = intval($zhanshi_qishu/$kua_2);
		$ku_3 = intval($zhanshi_qishu/$kua_3);
		$ku_4 = intval($zhanshi_qishu/$kua_4);
		$ku_5 = intval($zhanshi_qishu/$kua_5);
		$ku_6 = intval($zhanshi_qishu/$kua_6);
		$ku_7 = intval($zhanshi_qishu/$kua_7);
		$ku_8 = intval($zhanshi_qishu/$kua_8);
		$ku_9 = intval($zhanshi_qishu/$kua_9);
		$this->assign('ku_0',$ku_0);
		$this->assign('ku_1',$ku_1);
		$this->assign('ku_2',$ku_2);
		$this->assign('ku_3',$ku_3);
		$this->assign('ku_4',$ku_4);
		$this->assign('ku_5',$ku_5);
		$this->assign('ku_6',$ku_6);
		$this->assign('ku_7',$ku_7);
		$this->assign('ku_8',$ku_8);
		$this->assign('ku_9',$ku_9);

		$rand1 = rand(1,7);
		$rand2 = rand(1,7);
		$rand3 = rand(1,7);
		$rand4 = rand(1,7);
		$rand5 = rand(1,7);
		$rand6 = rand(1,7);
		$rand7 = rand(1,7);

		$this->assign('rand1',$rand1);
		$this->assign('rand2',$rand2);
		$this->assign('rand3',$rand3);
		$this->assign('rand4',$rand4);
		$this->assign('rand5',$rand5);
		$this->assign('rand6',$rand6);
		$this->assign('rand7',$rand7);

		$this->assign('qishu',$qishu);
		$this->assign('maifa',$maifa);
		$this->assign('arr',$zoushitu);
		$this->display();
	}
	public function pl3_xiazai(){
		$qishu = I("qishu");
		if($qishu==""){
			$qishu=1;
		}
		if($qishu=="1"){
			$zoushitu = M("zoushitu")->where("code='pl3'")->order("issue desc")->limit(30)->select();
		}elseif($qishu=="2"){
			$zoushitu = M("zoushitu")->where("code='pl3'")->order("issue desc")->limit(50)->select();
		}elseif($qishu=="3"){
			$zoushitu = M("zoushitu")->where("code='pl3'")->order("issue desc")->limit(200)->select();
		}

		$riqi = array();
		foreach ($zoushitu as $v) {
			$riqi[] = $v['issue'];
		}
		array_multisort($riqi, SORT_ASC, $zoushitu);

		//	导入phpExcel核心类
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel.php';
		require_once './simplewind/Lib/Util/PHPExcel_1.8.0/Classes/PHPExcel/IOFactory.php';

		$objPHPExcel = new \PHPExcel();
		$objPHPExcel->getActiveSheet()->getStyle('A1:C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		$iofactory=new \PHPExcel_IOFactory();



		//把数据循环写入excel中
		foreach($zoushitu as $key => $value){
			//设置excel列名
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1','编号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1','期号');
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1','开奖号码');
			$key+=1;
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$key,($key++)-1);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$key,$value['issue']);
			$objPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$key,trim($value['opencode']));
			$objPHPExcel->getActiveSheet()->getStyle('A' . $key . ':C' . $key)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
		}

		//excel保存在根目录下  如要导出文件，以下改为注释代码
		$objPHPExcel->getActiveSheet() -> setTitle('SetExcelName');
		$objPHPExcel-> setActiveSheetIndex(0);
		$objWriter = $iofactory -> createWriter($objPHPExcel, 'Excel2007');
		$str = "排列3报表";
		$outputFileName = $str.'.xlsx';
		$objWriter -> save('./data/upload/phpdaochu/'.$outputFileName);
		$url = './data/upload/phpdaochu/'.$outputFileName;
		header( "Content-Disposition:  attachment;  filename=".$outputFileName); //告诉浏览器通过附件形式来处理文件
		header('Content-Length: ' . filesize($url)); //下载文件大小
		readfile($url);  //读取文件内容
	}
























}